Re: [PATCH v2 2/4] phy: freescale: fsl-samsung-hdmi: Resume device on remove
From: Xu Yang
Date: Wed Jul 29 2026 - 05:33:18 EST
On Tue, Jul 21, 2026 at 02:47:50PM +0800, Can Peng wrote:
> The APB clock is acquired with devm_clk_get_enabled(), so devres will
> disable and unprepare it when the driver is unbound.
>
> Runtime suspend also disables the APB clock. If the device is runtime
> suspended when the driver is removed, devres will disable the already
> disabled clock and the clock enable count can underflow.
>
> Resume the device in the remove callback before devres runs so the final
> devres disable is balanced. Drop the runtime PM reference with noidle so
> the device is not suspended again before devres cleanup.
>
> Fixes: 6ad082bee902 ("phy: freescale: add Samsung HDMI PHY")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Can Peng <pengcan@xxxxxxxxxx>
> ---
> drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> index e7af4f9c7b20..5f41890bd134 100644
> --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> @@ -690,7 +690,16 @@ static int fsl_samsung_hdmi_phy_probe(struct platform_device *pdev)
>
> static void fsl_samsung_hdmi_phy_remove(struct platform_device *pdev)
> {
> + int ret;
> +
> + ret = pm_runtime_resume_and_get(&pdev->dev);
> + if (ret < 0)
> + dev_warn(&pdev->dev, "failed to resume on remove: %d\n", ret);
> +
> of_clk_del_provider(pdev->dev.of_node);
> +
> + if (!ret)
> + pm_runtime_put_noidle(&pdev->dev);
> }
The clk "apb" still may be disabled twice on removal for the same reason.
fsl_samsung_hdmi_phy_suspend() may be run after fsl_samsung_hdmi_phy_remove().
>
> static int __maybe_unused fsl_samsung_hdmi_phy_suspend(struct device *dev)
> --
> 2.53.0
>