[PATCH 03/15] i2c: busses: at91-core: Use devm_clk_get_enabled()

Andi Shyti
2023-06-11T23:37:16Z

Replace the pair of functions, devm_clk_get() and
clk_prepare_enable(), with a single function
devm_clk_get_enabled().

Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Cc: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
---
drivers/i2c/busses/i2c-at91-core.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at91-core.c
index 05ad3bc3578ac..2251e0deed29c 100644
--- a/drivers/i2c/busses/i2c-at91-core.c
+++ b/drivers/i2c/busses/i2c-at91-core.c
@@ -226,12 +226,11 @@ static int at91_twi_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, dev);

- dev->clk = devm_clk_get(dev->dev, NULL);
+ dev->clk = devm_clk_get_enabled(dev->dev, NULL);
if (IS_ERR(dev->clk)) {
- dev_err(dev->dev, "no clock defined\n");
+ dev_err(dev->dev, "failed to enable clock\n");
return -ENODEV;
}
- clk_prepare_enable(dev->clk);

snprintf(dev->adapter.name, sizeof(dev->adapter.name), "AT91");
i2c_set_adapdata(&dev->adapter, dev);
@@ -260,8 +259,6 @@ static int at91_twi_probe(struct platform_device *pdev)

rc = i2c_add_numbered_adapter(&dev->adapter);
if (rc) {
- clk_disable_unprepare(dev->clk);
-
pm_runtime_disable(dev->dev);
pm_runtime_set_suspended(dev->dev);

@@ -278,7 +275,6 @@ static void at91_twi_remove(struct platform_device *pdev)
struct at91_twi_dev *dev = platform_get_drvdata(pdev);

i2c_del_adapter(&dev->adapter);
- clk_disable_unprepare(dev->clk);

pm_runtime_disable(dev->dev);
pm_runtime_set_suspended(dev->dev);
--
2.40.1