[PATCH v2 2/4] phy: freescale: fsl-samsung-hdmi: Resume device on remove

Can Peng pengcan at kylinos.cn
Mon Jul 20 23:47:50 PDT 2026


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 at vger.kernel.org
Signed-off-by: Can Peng <pengcan at kylinos.cn>
---
 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);
 }
 
 static int __maybe_unused fsl_samsung_hdmi_phy_suspend(struct device *dev)
-- 
2.53.0




More information about the linux-phy mailing list