diff mbox series

fbdev: mmp: Use devm_clk_get_enabled() helpers

Message ID 20240823123027.5753-1-yingzuxin@vivo.com (mailing list archive)
State New, archived
Headers show
Series fbdev: mmp: Use devm_clk_get_enabled() helpers | expand

Commit Message

ying zuxin Aug. 23, 2024, 12:29 p.m. UTC
The devm_clk_get_enabled() helpers:
    - call devm_clk_get()
    - call clk_prepare_enable() and register what is needed in order to
     call clk_disable_unprepare() when needed, as a managed resource.

This simplifies the code and avoids the calls to clk_disable_unprepare().

Signed-off-by: ying zuxin <yingzuxin@vivo.com>
---
 drivers/video/fbdev/mmp/hw/mmp_ctrl.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Helge Deller Aug. 28, 2024, 6:01 p.m. UTC | #1
On 8/23/24 14:29, ying zuxin wrote:
> The devm_clk_get_enabled() helpers:
>      - call devm_clk_get()
>      - call clk_prepare_enable() and register what is needed in order to
>       call clk_disable_unprepare() when needed, as a managed resource.
>
> This simplifies the code and avoids the calls to clk_disable_unprepare().
>
> Signed-off-by: ying zuxin <yingzuxin@vivo.com>
> ---
>   drivers/video/fbdev/mmp/hw/mmp_ctrl.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)

applied.

Thanks!
Helge
diff mbox series

Patch

diff --git a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c
index a20a2c408127..03e23173198c 100644
--- a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c
+++ b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c
@@ -512,16 +512,13 @@  static int mmphw_probe(struct platform_device *pdev)
 	}
 
 	/* get clock */
-	ctrl->clk = devm_clk_get(ctrl->dev, mi->clk_name);
+	ctrl->clk = devm_clk_get_enabled(ctrl->dev, mi->clk_name);
 	if (IS_ERR(ctrl->clk)) {
 		ret = PTR_ERR(ctrl->clk);
 		dev_err_probe(ctrl->dev, ret,
 			      "unable to get clk %s\n", mi->clk_name);
 		goto failed;
 	}
-	ret = clk_prepare_enable(ctrl->clk);
-	if (ret)
-		goto failed;
 
 	/* init global regs */
 	ctrl_set_default(ctrl);
@@ -556,7 +553,6 @@  static int mmphw_probe(struct platform_device *pdev)
 		path_deinit(path_plat);
 	}
 
-	clk_disable_unprepare(ctrl->clk);
 failed:
 	dev_err(&pdev->dev, "device init failed\n");