Skip to contentSkip to conversation

clocksource: ingenic: Use devm_clk_get_enabled() helpers

PATCH Applied Huan Yang 2 participants 2 messages Aug 20, 2024 – Sep 6, 2024 Clocksource, clockevent drivers

lore
Share & tools
lore

Huan Yang

author
#0 lore raw

PATCH 1/1 clocksource: ingenic: Use devm_clk_get_enabled() helpers

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().

---
 drivers/clocksource/ingenic-ost.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/clocksource/ingenic-ost.c +1 -6
index 9f7c280a1336..e0ec33307c84 100644
@@ -93,14 +93,10 @@ static int __init ingenic_ost_probe(struct platform_device *pdev)
 		return PTR_ERR(map);
 	}
 
-	ost->clk = devm_clk_get(dev, "ost");
+	ost->clk = devm_clk_get_enabled(dev, "ost");
 	if (IS_ERR(ost->clk))
 		return PTR_ERR(ost->clk);
 
-	err = clk_prepare_enable(ost->clk);
-	if (err)
-		return err;
-
 	/* Clear counter high/low registers */
 	if (soc_info->is64bit)
 		regmap_write(map, TCU_REG_OST_CNTL, 0);
@@ -129,7 +125,6 @@ static int __init ingenic_ost_probe(struct platform_device *pdev)
 	err = clocksource_register_hz(cs, rate);
 	if (err) {
 		dev_err(dev, "clocksource registration failed");
-		clk_disable_unprepare(ost->clk);
 		return err;
 	}
 
Signature · 1 line
2.45.2
merge bot Applied
#1 lore raw

[tip: timers/core] clocksource/drivers/ingenic: Use devm_clk_get_enabled() helpers

The following commit has been merged into the timers/core branch of tip:

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     414b2fb4bb5aa09f39262c24ed90b831d18ff984
Gitweb:        https://git.kernel.org/tip/414b2fb4bb5aa09f39262c24ed90b831d18ff984
Author:        Huan Yang <[email protected]>
AuthorDate:    Tue, 20 Aug 2024 17:46:03 +08:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Fri, 06 Sep 2024 14:49:20 +02:00

clocksource/drivers/ingenic: Use devm_clk_get_enabled() helpers

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().

---
 drivers/clocksource/ingenic-ost.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/clocksource/ingenic-ost.c +1 -6
index 9f7c280..e0ec333 100644
@@ -93,14 +93,10 @@ static int __init ingenic_ost_probe(struct platform_device *pdev)
 		return PTR_ERR(map);
 	}
 
-	ost->clk = devm_clk_get(dev, "ost");
+	ost->clk = devm_clk_get_enabled(dev, "ost");
 	if (IS_ERR(ost->clk))
 		return PTR_ERR(ost->clk);
 
-	err = clk_prepare_enable(ost->clk);
-	if (err)
-		return err;
-
 	/* Clear counter high/low registers */
 	if (soc_info->is64bit)
 		regmap_write(map, TCU_REG_OST_CNTL, 0);
@@ -129,7 +125,6 @@ static int __init ingenic_ost_probe(struct platform_device *pdev)
 	err = clocksource_register_hz(cs, rate);
 	if (err) {
 		dev_err(dev, "clocksource registration failed");
-		clk_disable_unprepare(ost->clk);
 		return err;
 	}