[PATCH] phy: freescale: fsl-samsung-hdmi: Use helper function devm_clk_get_enabled()

xiaopeitux@foxmail.com posted 1 patch 10 months, 2 weeks ago
drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
[PATCH] phy: freescale: fsl-samsung-hdmi: Use helper function devm_clk_get_enabled()
Posted by xiaopeitux@foxmail.com 10 months, 2 weeks ago
From: Pei Xiao <xiaopei01@kylinos.cn>

Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared
and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be
replaced by devm_clk_get_enabled() when driver enables the clocks for the
whole lifetime of the device. Moreover, it is no longer necessary to
unprepare and disable the clocks explicitly.

Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
 drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
index 6817ceabaab4..7be625a25f9a 100644
--- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
+++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
@@ -669,7 +669,7 @@ static int fsl_samsung_hdmi_phy_probe(struct platform_device *pdev)
 	if (IS_ERR(phy->regs))
 		return PTR_ERR(phy->regs);
 
-	phy->apbclk = devm_clk_get(phy->dev, "apb");
+	phy->apbclk = devm_clk_get_enabled(phy->dev, "apb");
 	if (IS_ERR(phy->apbclk))
 		return dev_err_probe(phy->dev, PTR_ERR(phy->apbclk),
 				     "failed to get apb clk\n");
@@ -679,12 +679,6 @@ static int fsl_samsung_hdmi_phy_probe(struct platform_device *pdev)
 		return dev_err_probe(phy->dev, PTR_ERR(phy->refclk),
 				     "failed to get ref clk\n");
 
-	ret = clk_prepare_enable(phy->apbclk);
-	if (ret) {
-		dev_err(phy->dev, "failed to enable apbclk\n");
-		return ret;
-	}
-
 	pm_runtime_get_noresume(phy->dev);
 	pm_runtime_set_active(phy->dev);
 	pm_runtime_enable(phy->dev);
@@ -700,8 +694,6 @@ static int fsl_samsung_hdmi_phy_probe(struct platform_device *pdev)
 	return 0;
 
 register_clk_failed:
-	clk_disable_unprepare(phy->apbclk);
-
 	return ret;
 }
 
-- 
2.25.1
Re: [PATCH] phy: freescale: fsl-samsung-hdmi: Use helper function devm_clk_get_enabled()
Posted by Vinod Koul 10 months, 1 week ago
On Sat, 08 Feb 2025 11:44:01 +0800, xiaopeitux@foxmail.com wrote:
> Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared
> and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be
> replaced by devm_clk_get_enabled() when driver enables the clocks for the
> whole lifetime of the device. Moreover, it is no longer necessary to
> unprepare and disable the clocks explicitly.
> 
> 
> [...]

Applied, thanks!

[1/1] phy: freescale: fsl-samsung-hdmi: Use helper function devm_clk_get_enabled()
      commit: 279950205dde78bc0e3ca73a8dfee6842f0e1edc

Best regards,
-- 
~Vinod