Re: [PATCH 3/9] phy: qcom: uniphy: Update UNIPHY driver to be a common driver

From: Krzysztof Kozlowski
Date: Tue Aug 29 2023 - 12:58:43 EST


On 29/08/2023 15:58, Praveenkumar I wrote:
> This patch updates the UNIPHY driver to be a common driver to

Please do not use "This commit/patch", but imperative mood. See longer
explanation here:
https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95

> accommodate all UNIPHY / Combo PHY. This driver can be used for
> both USB and PCIe UNIPHY. Using phy-mul-sel from DTS MUX selection
> for USB / PCIe can be acheived.

This patch is entirely unreadable. You speak "unify" but change much
more. There is no code removal, so what are you unifying?

...

> - phy->phy = devm_phy_create(dev, NULL, of_device_get_match_data(dev));
> - if (IS_ERR(phy->phy)) {
> - dev_err(dev, "failed to create PHY\n");
> - return PTR_ERR(phy->phy);
> + uniphy->phy = devm_phy_create(dev, NULL, &uniphy_phy_ops);

NAK, really, this does not make sense, is not explained and not needed.
If needed, then it would deserve its own patch with own justification.

> + if (IS_ERR(uniphy->phy)) {
> + ret = PTR_ERR(uniphy->phy);
> + dev_err_probe(dev, ret, "failed to create PHY\n");

That's not even the syntax. By "unifying" you introduce different, wrong
code.

> + goto err;
> }
> - phy_set_drvdata(phy->phy, phy);
> +
> + phy_set_drvdata(uniphy->phy, uniphy);
>
> phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
>
> - return PTR_ERR_OR_ZERO(phy_provider);
> + ret = PTR_ERR_OR_ZERO(phy_provider);
> +
> +err:
> + if (uniphy->cfg->pipe_clk_rate)
> + of_node_put(np);
> + return ret;
> }
>
> -static struct platform_driver ipq4019_usb_phy_driver = {
> - .probe = ipq4019_usb_phy_probe,
> +static const struct of_device_id qcom_uniphy_of_match[] = {
> + { .compatible = "qcom,usb-hs-ipq4019-phy", .data = &ipq4019_usb_hsphy_cfg},
> + { .compatible = "qcom,usb-ss-ipq4019-phy", .data = &ipq4019_usb_ssphy_cfg},
> + { },
> +};
> +MODULE_DEVICE_TABLE(of, qcom_uniphy_of_match);

What happens here?

Best regards,
Krzysztof