Thread (24 messages) 24 messages, 3 authors, 2023-08-21
STALE1053d

[PATCH -next 05/11] gpio: mb86s7x: Use helper function devm_clk_get_optional_enabled()

From: Li Zetao <hidden>
Date: 2023-08-18 09:31:37
Also in: linux-gpio, linux-omap, linux-pwm
Subsystem: gpio subsystem, the rest · Maintainers: Linus Walleij, Bartosz Golaszewski, Linus Torvalds

Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for
prepared and enabled clocks"), devm_clk_get_optional() and
clk_prepare_enable() can now be replaced by
devm_clk_get_optional_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 <redacted>
---
 drivers/gpio/gpio-mb86s7x.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/gpio/gpio-mb86s7x.c b/drivers/gpio/gpio-mb86s7x.c
index ca7eb5e8bfaa..8f2abc914dfa 100644
--- a/drivers/gpio/gpio-mb86s7x.c
+++ b/drivers/gpio/gpio-mb86s7x.c
@@ -170,14 +170,10 @@ static int mb86s70_gpio_probe(struct platform_device *pdev)
 	if (IS_ERR(gchip->base))
 		return PTR_ERR(gchip->base);
 
-	gchip->clk = devm_clk_get_optional(&pdev->dev, NULL);
+	gchip->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
 	if (IS_ERR(gchip->clk))
 		return PTR_ERR(gchip->clk);
 
-	ret = clk_prepare_enable(gchip->clk);
-	if (ret)
-		return ret;
-
 	spin_lock_init(&gchip->lock);
 
 	gchip->gc.direction_output = mb86s70_gpio_direction_output;
@@ -196,7 +192,6 @@ static int mb86s70_gpio_probe(struct platform_device *pdev)
 	ret = gpiochip_add_data(&gchip->gc, gchip);
 	if (ret) {
 		dev_err(&pdev->dev, "couldn't register gpio driver\n");
-		clk_disable_unprepare(gchip->clk);
 		return ret;
 	}
 
@@ -211,7 +206,6 @@ static int mb86s70_gpio_remove(struct platform_device *pdev)
 
 	acpi_gpiochip_free_interrupts(&gchip->gc);
 	gpiochip_remove(&gchip->gc);
-	clk_disable_unprepare(gchip->clk);
 
 	return 0;
 }
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help