Re: [PATCH v7 2/5] phy: qcom-m31: Introduce qcom,m31 USB phy driver

Krzysztof Kozlowski
2023-08-14T10:05:35Z

On 10/08/2023 11:56, Varadarajan Narayanan wrote:
> Add the M31 USB2 phy driver.
>
> Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
> ---

...

> +static int m31usb_phy_probe(struct platform_device *pdev)
> +{
> + struct phy_provider *phy_provider;
> + const struct m31_priv_data *data;
> + struct device *dev = &pdev->dev;
> + struct m31usb_phy *qphy;
> +
> + qphy = devm_kzalloc(dev, sizeof(*qphy), GFP_KERNEL);
> + if (!qphy)
> + return -ENOMEM;
> +
> + qphy->base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(qphy->base))
> + return PTR_ERR(qphy->base);
> +
> + qphy->reset = devm_reset_control_get_exclusive_by_index(dev, 0);
> + if (IS_ERR(qphy->reset))
> + return PTR_ERR(qphy->reset);
> +
> + qphy->clk = devm_clk_get(dev, NULL);
> + if (IS_ERR(qphy->clk))
> + return dev_err_probe(dev, PTR_ERR(qphy->clk),
> + "failed to get clk\n");

This looks misaligned.

> +
> + data = of_device_get_match_data(dev);
> + qphy->regs = data->regs;
> + qphy->nregs = data->nregs;
> + qphy->ulpi_mode = data->ulpi_mode;
> +
> + qphy->phy = devm_phy_create(dev, NULL, &m31usb_phy_gen_ops);
> + if (IS_ERR(qphy->phy))
> + return dev_err_probe(dev, PTR_ERR(qphy->phy),
> + "failed to create phy\n");

Ditto... and in other places.

> +
> + qphy->vreg = devm_regulator_get(dev, "vdda-phy");
> + if (IS_ERR(qphy->vreg))
> + return dev_err_probe(dev, PTR_ERR(qphy->phy),
> + "failed to get vreg\n");
> +
> + phy_set_drvdata(qphy->phy, qphy);
> +
> + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
> + if (!IS_ERR(phy_provider))
> + dev_info(dev, "Registered M31 USB phy\n");

Drop simple success messages. Kernel has other means to do it.

Best regards,
Krzysztof