Re: [PATCH v3 2/5] phy: realtek: usb: Add driver for the Realtek SoC USB 2.0 PHY

Krzysztof Kozlowski
2023-06-07T11:55:27Z

On 07/06/2023 08:24, Stanley Chang wrote:
> Realtek DHC (digital home center) RTD SoCs support DWC3 XHCI USB
> controller. Added the driver to drive the USB 2.0 PHY transceivers.
>
> Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
> ---
> v2 to v3 change:
> 1. Broken down into two patches, one for each of USB 2 & 3 PHY.
> 2. Removed parameter v1 support for simplification.
> 3. Use remove_new for driver remove callback.

...

> + platform_set_drvdata(pdev, rtk_phy);
> +
> + generic_phy = devm_phy_create(rtk_phy->dev, NULL, &ops);
> + if (IS_ERR(generic_phy))
> + return PTR_ERR(generic_phy);
> +
> + phy_set_drvdata(generic_phy, rtk_phy);
> +
> + phy_provider = devm_of_phy_provider_register(rtk_phy->dev,
> + of_phy_simple_xlate);
> + if (IS_ERR(phy_provider))
> + return PTR_ERR(phy_provider);
> +
> + ret = usb_add_phy_dev(&rtk_phy->phy);
> + if (ret)
> + goto err;
> +
> + create_debug_files(rtk_phy);
> +
> +err:
> + dev_dbg(dev, "Probe RTK USB 2.0 PHY (ret=%d)\n", ret);

I commented on your second patch, but everything is applicable here as
well. You have many useless debug messages. Many incorrect or useless
"if() return" which point to broken driver design (e.g. concurrent
access to half initialized structures where you substitute lack of
synchronization with incorrect "if() return"). Undocumented user
interface is one more big trouble.

I doubt you run checkpatch on this (be sure to run it with --strict and
fix almost everything).

Best regards,
Krzysztof