Re: [PATCH 03/26] phy: qcom: add the SGMII SerDes PHY driver

From: Bjorn Andersson
Date: Tue Jun 13 2023 - 13:36:23 EST


On Mon, Jun 12, 2023 at 11:23:32AM +0200, Bartosz Golaszewski wrote:
> diff --git a/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c b/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c
[..]
> +static int qcom_dwmac_sgmii_phy_probe(struct platform_device *pdev)
> +{
> + struct qcom_dwmac_sgmii_phy_data *data;
> + struct device *dev = &pdev->dev;
> + struct phy_provider *provider;
> + struct clk *refclk;
> + void __iomem *base;
> + struct phy *phy;
> +
> + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> + if (!data)
> + return -ENOMEM;
> +
> + base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(base))
> + return PTR_ERR(base);
> +
> + data->regmap = devm_regmap_init_mmio(dev, base,
> + &qcom_dwmac_sgmii_phy_regmap_cfg);
> + if (IS_ERR(data->regmap))
> + return PTR_ERR(data->regmap);
> +
> + phy = devm_phy_create(dev, NULL, &qcom_dwmac_sgmii_phy_ops);
> + if (IS_ERR(phy))
> + return PTR_ERR(phy);
> +
> + refclk = devm_clk_get_enabled(dev, "sgmi_ref");
> + if (IS_ERR(refclk))
> + return PTR_ERR(refclk);
> +
> + provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
> + if (IS_ERR(provider))
> + return PTR_ERR(provider);
> +
> + phy_set_drvdata(phy, data);
> + platform_set_drvdata(pdev, data);

You don't use the pdev's dev's drvdata, so I think you can drop the
platform_set_drvdata()

Regards,
Bjorn

> +
> + return 0;
> +}