[PATCH net-next v10 07/11] net: pcs: xpcs: add Rockchip RK3568 platform glue driver
Coia Prant
coiaprant at gmail.com
Wed Sep 23 22:12:57 PDT 2026
<sashiko-bot at kernel.org> 于2026年9月24日周四 04:05写道:
>
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] pm: unbalanced pm_runtime_enable on teardown
> --
>
> commit 43d28493f3eec64a96af219e5448ffe0efe56d58
> Author: Coia Prant <coiaprant at gmail.com>
> net: pcs: xpcs: add Rockchip RK3568 platform glue driver
>
> This commit introduces a new platform glue driver for the Synopsys DesignWare
> XPCS on Rockchip RK3568 SoCs. It implements an MDIO bus that translates
> requests to APB3 memory-mapped registers. It also adds necessary clock and
> power domain management for the device.
>
> Link: https://dl.radxa.com/rock3/docs/hw/datasheet/Rockchip%20RK3568%20TRM%20Part1%20V1.1-20210301.pdf (Page 59, CRU_CLKSEL_CON29)
> Link: https://dl.radxa.com/rock3/docs/hw/datasheet/Rockchip%20RK3568%20TRM%20Part2%20V1.1-20210301.pdf (Page 2078)
>
> > diff --git a/drivers/net/pcs/pcs-xpcs-rk.c b/drivers/net/pcs/pcs-xpcs-rk.c
> > new file mode 100644
> > index 0000000000000..35ee980a759e5
> > --- /dev/null
> > +++ b/drivers/net/pcs/pcs-xpcs-rk.c
> [ ... ]
> > +static void xpcs_rk_exit_clk(void *data)
> > +{
> > + struct dw_xpcs_rk *pxpcs = data;
> > + struct device *dev = &pxpcs->pdev->dev;
> > +
> > + pm_runtime_force_suspend(dev);
> > + clk_disable_unprepare(pxpcs->eee_clk);
> > +}
>
> [Severity: Medium]
> Could this lead to an unbalanced pm_runtime_enable?
>
> In xpcs_rk_init_clk(), pm_runtime_enable(dev) is called, and this function
> xpcs_rk_exit_clk() is registered as the devm teardown action. However,
> pm_runtime_disable(dev) is not called here.
>
> If the driver is unbound via sysfs or fails to probe later in the sequence,
> the teardown action runs but leaves PM runtime enabled. This can trigger
> kernel warnings about an unbalanced pm_runtime_enable and break subsequent
> device binding PM state.
pm_runtime_force_suspend() calls pm_runtime_disable() unconditionally
before invoking the runtime_suspend callback, so runtime PM is already
disabled on the success path. The runtime_suspend callback in this
driver always returns 0, so the error path that re-enables runtime PM
is never taken. No change needed.
More information about the linux-phy
mailing list