[PATCH -next 04/11] gpio: lpc18xx: Use helper function devm_clk_get_enabled()
Li Zetao
lizetao1 at huawei.com
Fri Aug 18 02:30:11 PDT 2023
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 the driver enables
(and possibly prepares) 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: Li Zetao <lizetao1 at huawei.com>
---
drivers/gpio/gpio-lpc18xx.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/gpio/gpio-lpc18xx.c b/drivers/gpio/gpio-lpc18xx.c
index ed3f653a1dfc..389f4d8befb0 100644
--- a/drivers/gpio/gpio-lpc18xx.c
+++ b/drivers/gpio/gpio-lpc18xx.c
@@ -352,18 +352,13 @@ static int lpc18xx_gpio_probe(struct platform_device *pdev)
if (IS_ERR(gc->base))
return PTR_ERR(gc->base);
- gc->clk = devm_clk_get(dev, NULL);
+ gc->clk = devm_clk_get_enabled(dev, NULL);
if (IS_ERR(gc->clk)) {
- dev_err(dev, "input clock not found\n");
+ dev_err(dev,
+ "input clock not found or unable to enable clock\n");
return PTR_ERR(gc->clk);
}
- ret = clk_prepare_enable(gc->clk);
- if (ret) {
- dev_err(dev, "unable to enable clock\n");
- return ret;
- }
-
spin_lock_init(&gc->lock);
gc->gpio.parent = dev;
@@ -371,7 +366,6 @@ static int lpc18xx_gpio_probe(struct platform_device *pdev)
ret = devm_gpiochip_add_data(dev, &gc->gpio, gc);
if (ret) {
dev_err(dev, "failed to add gpio chip\n");
- clk_disable_unprepare(gc->clk);
return ret;
}
@@ -388,8 +382,6 @@ static int lpc18xx_gpio_remove(struct platform_device *pdev)
if (gc->pin_ic)
irq_domain_remove(gc->pin_ic->domain);
- clk_disable_unprepare(gc->clk);
-
return 0;
}
--
2.34.1
More information about the linux-arm-kernel
mailing list