All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled()
@ 2023-06-11 22:56 Andi Shyti
  2023-06-11 22:56 ` [PATCH 01/15] i2c: busses: emev2: " Andi Shyti
                   ` (15 more replies)
  0 siblings, 16 replies; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:56 UTC (permalink / raw)
  To: Linux I2C; +Cc: Andi Shyti

Hi,

After having sent some cleanups for using devm_clk_get_enabled(),
I decided to expand a bit to some of the i2c drivers.

Andi

Andi Shyti (15):
  i2c: busses: emev2: Use devm_clk_get_enabled()
  i2c: busses: xiic: Use devm_clk_get_enabled()
  i2c: busses: at91-core: Use devm_clk_get_enabled()
  i2c: busses: exynos5: Use devm_clk_get_enabled()
  i2c: busses: hix5hd2: Use devm_clk_get_enabled()
  i2c: busses: jz4780: Use devm_clk_get_enabled()
  i2c: busses: lpc2k: Use devm_clk_get_enabled()
  i2c: busses: mt7621: Use devm_clk_get_enabled()
  i2c: busses: owl: Use devm_clk_get_enabled()
  i2c: busses: pasemi-platform: Use devm_clk_get_enabled()
  i2c: busses: stm32f4: Use devm_clk_get_enabled()
  i2c: busses: stm32f7: Use devm_clk_get_enabled()
  i2c: busses: sun6i-p2wi: Use devm_clk_get_enabled()
  i2c: busses: uniphier-f: Use devm_clk_get_enabled()
  i2c: busses: uniphier: Use devm_clk_get_enabled()

 drivers/i2c/busses/i2c-at91-core.c       |  8 ++---
 drivers/i2c/busses/i2c-emev2.c           | 17 +++------
 drivers/i2c/busses/i2c-exynos5.c         | 44 +++++++-----------------
 drivers/i2c/busses/i2c-hix5hd2.c         | 11 +++---
 drivers/i2c/busses/i2c-jz4780.c          | 25 ++++----------
 drivers/i2c/busses/i2c-lpc2k.c           | 22 +++---------
 drivers/i2c/busses/i2c-mt7621.c          | 20 +++--------
 drivers/i2c/busses/i2c-owl.c             | 18 +++-------
 drivers/i2c/busses/i2c-pasemi-platform.c | 22 +++---------
 drivers/i2c/busses/i2c-stm32f4.c         | 32 ++++++-----------
 drivers/i2c/busses/i2c-stm32f7.c         | 37 +++++++-------------
 drivers/i2c/busses/i2c-sun6i-p2wi.c      | 17 ++-------
 drivers/i2c/busses/i2c-uniphier-f.c      | 21 +++--------
 drivers/i2c/busses/i2c-uniphier.c        | 21 +++--------
 drivers/i2c/busses/i2c-xiic.c            | 20 ++++-------
 15 files changed, 87 insertions(+), 248 deletions(-)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 01/15] i2c: busses: emev2: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
@ 2023-06-11 22:56 ` Andi Shyti
  2023-06-12  7:11   ` Geert Uytterhoeven
  2023-06-11 22:56 ` [PATCH 02/15] i2c: busses: xiic: " Andi Shyti
                   ` (14 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:56 UTC (permalink / raw)
  To: Linux I2C; +Cc: Andi Shyti, Wolfram Sang, Geert Uytterhoeven, Magnus Damm

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: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Magnus Damm <magnus.damm@gmail.com>
---
 drivers/i2c/busses/i2c-emev2.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/i2c/busses/i2c-emev2.c b/drivers/i2c/busses/i2c-emev2.c
index 4ba93cd91c0f0..d080b829f142b 100644
--- a/drivers/i2c/busses/i2c-emev2.c
+++ b/drivers/i2c/busses/i2c-emev2.c
@@ -373,14 +373,10 @@ static int em_i2c_probe(struct platform_device *pdev)
 
 	strscpy(priv->adap.name, "EMEV2 I2C", sizeof(priv->adap.name));
 
-	priv->sclk = devm_clk_get(&pdev->dev, "sclk");
+	priv->sclk = devm_clk_get_enabled(&pdev->dev, "sclk");
 	if (IS_ERR(priv->sclk))
 		return PTR_ERR(priv->sclk);
 
-	ret = clk_prepare_enable(priv->sclk);
-	if (ret)
-		return ret;
-
 	priv->adap.timeout = msecs_to_jiffies(100);
 	priv->adap.retries = 5;
 	priv->adap.dev.parent = &pdev->dev;
@@ -397,26 +393,22 @@ static int em_i2c_probe(struct platform_device *pdev)
 
 	ret = platform_get_irq(pdev, 0);
 	if (ret < 0)
-		goto err_clk;
+		return ret;
 	priv->irq = ret;
 	ret = devm_request_irq(&pdev->dev, priv->irq, em_i2c_irq_handler, 0,
 				"em_i2c", priv);
 	if (ret)
-		goto err_clk;
+		return ret;
 
 	ret = i2c_add_adapter(&priv->adap);
 
 	if (ret)
-		goto err_clk;
+		return ret;
 
 	dev_info(&pdev->dev, "Added i2c controller %d, irq %d\n", priv->adap.nr,
 		 priv->irq);
 
 	return 0;
-
-err_clk:
-	clk_disable_unprepare(priv->sclk);
-	return ret;
 }
 
 static void em_i2c_remove(struct platform_device *dev)
@@ -424,7 +416,6 @@ static void em_i2c_remove(struct platform_device *dev)
 	struct em_i2c_device *priv = platform_get_drvdata(dev);
 
 	i2c_del_adapter(&priv->adap);
-	clk_disable_unprepare(priv->sclk);
 }
 
 static const struct of_device_id em_i2c_ids[] = {
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 02/15] i2c: busses: xiic: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
  2023-06-11 22:56 ` [PATCH 01/15] i2c: busses: emev2: " Andi Shyti
@ 2023-06-11 22:56 ` Andi Shyti
  2023-06-12  8:07   ` Michal Simek
  2023-06-23  9:54   ` Wolfram Sang
  2023-06-11 22:56 ` [PATCH 03/15] i2c: busses: at91-core: " Andi Shyti
                   ` (13 subsequent siblings)
  15 siblings, 2 replies; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:56 UTC (permalink / raw)
  To: Linux I2C; +Cc: Andi Shyti, Michal Simek

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: Michal Simek <michal.simek@amd.com>
---
 drivers/i2c/busses/i2c-xiic.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 61288f8dd0672..f879af4def5ed 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -1256,16 +1256,11 @@ static int xiic_i2c_probe(struct platform_device *pdev)
 
 	mutex_init(&i2c->lock);
 
-	i2c->clk = devm_clk_get(&pdev->dev, NULL);
+	i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(i2c->clk))
 		return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk),
-				     "input clock not found.\n");
+				     "failed to enable input clock.\n");
 
-	ret = clk_prepare_enable(i2c->clk);
-	if (ret) {
-		dev_err(&pdev->dev, "Unable to enable clock.\n");
-		return ret;
-	}
 	i2c->dev = &pdev->dev;
 	pm_runtime_set_autosuspend_delay(i2c->dev, XIIC_PM_TIMEOUT);
 	pm_runtime_use_autosuspend(i2c->dev);
@@ -1286,7 +1281,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
 
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Cannot claim IRQ\n");
-		goto err_clk_dis;
+		goto err_pm_disable;
 	}
 
 	i2c->singlemaster =
@@ -1307,14 +1302,14 @@ static int xiic_i2c_probe(struct platform_device *pdev)
 	ret = xiic_reinit(i2c);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Cannot xiic_reinit\n");
-		goto err_clk_dis;
+		goto err_pm_disable;
 	}
 
 	/* add i2c adapter to i2c tree */
 	ret = i2c_add_adapter(&i2c->adap);
 	if (ret) {
 		xiic_deinit(i2c);
-		goto err_clk_dis;
+		goto err_pm_disable;
 	}
 
 	if (pdata) {
@@ -1328,10 +1323,10 @@ static int xiic_i2c_probe(struct platform_device *pdev)
 
 	return 0;
 
-err_clk_dis:
+err_pm_disable:
 	pm_runtime_set_suspended(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-	clk_disable_unprepare(i2c->clk);
+
 	return ret;
 }
 
@@ -1352,7 +1347,6 @@ static void xiic_i2c_remove(struct platform_device *pdev)
 		xiic_deinit(i2c);
 
 	pm_runtime_put_sync(i2c->dev);
-	clk_disable_unprepare(i2c->clk);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 	pm_runtime_dont_use_autosuspend(&pdev->dev);
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 03/15] i2c: busses: at91-core: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
  2023-06-11 22:56 ` [PATCH 01/15] i2c: busses: emev2: " Andi Shyti
  2023-06-11 22:56 ` [PATCH 02/15] i2c: busses: xiic: " Andi Shyti
@ 2023-06-11 22:56 ` Andi Shyti
  2023-06-23 10:23   ` Wolfram Sang
                     ` (2 more replies)
  2023-06-11 22:56 ` [PATCH 04/15] i2c: busses: exynos5: " Andi Shyti
                   ` (12 subsequent siblings)
  15 siblings, 3 replies; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:56 UTC (permalink / raw)
  To: Linux I2C
  Cc: Andi Shyti, Codrin Ciubotariu, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea

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


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 04/15] i2c: busses: exynos5: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
                   ` (2 preceding siblings ...)
  2023-06-11 22:56 ` [PATCH 03/15] i2c: busses: at91-core: " Andi Shyti
@ 2023-06-11 22:56 ` Andi Shyti
  2023-06-23 10:03   ` Wolfram Sang
  2023-06-11 22:56 ` [PATCH 05/15] i2c: busses: hix5hd2: " Andi Shyti
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:56 UTC (permalink / raw)
  To: Linux I2C; +Cc: Andi Shyti, Krzysztof Kozlowski, Alim Akhtar

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: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
---
 drivers/i2c/busses/i2c-exynos5.c | 44 +++++++++-----------------------
 1 file changed, 12 insertions(+), 32 deletions(-)

diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c
index f378cd479e558..6f76d0027aeae 100644
--- a/drivers/i2c/busses/i2c-exynos5.c
+++ b/drivers/i2c/busses/i2c-exynos5.c
@@ -808,30 +808,20 @@ static int exynos5_i2c_probe(struct platform_device *pdev)
 	i2c->adap.retries = 3;
 
 	i2c->dev = &pdev->dev;
-	i2c->clk = devm_clk_get(&pdev->dev, "hsi2c");
-	if (IS_ERR(i2c->clk)) {
-		dev_err(&pdev->dev, "cannot get clock\n");
-		return -ENOENT;
-	}
+	i2c->clk = devm_clk_get_enabled(&pdev->dev, "hsi2c");
+	if (IS_ERR(i2c->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk),
+				     "cannot enable clock\n");
 
-	i2c->pclk = devm_clk_get_optional(&pdev->dev, "hsi2c_pclk");
-	if (IS_ERR(i2c->pclk)) {
+	i2c->pclk = devm_clk_get_optional_enabled(&pdev->dev, "hsi2c_pclk");
+	if (IS_ERR(i2c->pclk))
 		return dev_err_probe(&pdev->dev, PTR_ERR(i2c->pclk),
-				     "cannot get pclk");
-	}
-
-	ret = clk_prepare_enable(i2c->pclk);
-	if (ret)
-		return ret;
-
-	ret = clk_prepare_enable(i2c->clk);
-	if (ret)
-		goto err_pclk;
+				     "cannot enable pclk");
 
 	i2c->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(i2c->regs)) {
 		ret = PTR_ERR(i2c->regs);
-		goto err_clk;
+		return ret;
 	}
 
 	i2c->adap.dev.of_node = np;
@@ -846,26 +836,26 @@ static int exynos5_i2c_probe(struct platform_device *pdev)
 
 	i2c->irq = ret = platform_get_irq(pdev, 0);
 	if (ret < 0)
-		goto err_clk;
+		return ret;
 
 	ret = devm_request_irq(&pdev->dev, i2c->irq, exynos5_i2c_irq,
 			       IRQF_NO_SUSPEND, dev_name(&pdev->dev), i2c);
 	if (ret != 0) {
 		dev_err(&pdev->dev, "cannot request HS-I2C IRQ %d\n", i2c->irq);
-		goto err_clk;
+		return ret;
 	}
 
 	i2c->variant = of_device_get_match_data(&pdev->dev);
 
 	ret = exynos5_hsi2c_clock_setup(i2c);
 	if (ret)
-		goto err_clk;
+		return ret;
 
 	exynos5_i2c_reset(i2c);
 
 	ret = i2c_add_adapter(&i2c->adap);
 	if (ret < 0)
-		goto err_clk;
+		return ret;
 
 	platform_set_drvdata(pdev, i2c);
 
@@ -873,13 +863,6 @@ static int exynos5_i2c_probe(struct platform_device *pdev)
 	clk_disable(i2c->pclk);
 
 	return 0;
-
- err_clk:
-	clk_disable_unprepare(i2c->clk);
-
- err_pclk:
-	clk_disable_unprepare(i2c->pclk);
-	return ret;
 }
 
 static void exynos5_i2c_remove(struct platform_device *pdev)
@@ -887,9 +870,6 @@ static void exynos5_i2c_remove(struct platform_device *pdev)
 	struct exynos5_i2c *i2c = platform_get_drvdata(pdev);
 
 	i2c_del_adapter(&i2c->adap);
-
-	clk_unprepare(i2c->clk);
-	clk_unprepare(i2c->pclk);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 05/15] i2c: busses: hix5hd2: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
                   ` (3 preceding siblings ...)
  2023-06-11 22:56 ` [PATCH 04/15] i2c: busses: exynos5: " Andi Shyti
@ 2023-06-11 22:56 ` Andi Shyti
  2023-06-23 10:09   ` Wolfram Sang
  2023-06-11 22:56 ` [PATCH 06/15] i2c: busses: jz4780: " Andi Shyti
                   ` (10 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:56 UTC (permalink / raw)
  To: Linux I2C; +Cc: Andi Shyti

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>
---
 drivers/i2c/busses/i2c-hix5hd2.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c
index 64feaa9dca619..aecbe967e2640 100644
--- a/drivers/i2c/busses/i2c-hix5hd2.c
+++ b/drivers/i2c/busses/i2c-hix5hd2.c
@@ -416,12 +416,11 @@ static int hix5hd2_i2c_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
-	priv->clk = devm_clk_get(&pdev->dev, NULL);
+	priv->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(priv->clk)) {
-		dev_err(&pdev->dev, "cannot get clock\n");
+		dev_err(&pdev->dev, "cannot enable clock\n");
 		return PTR_ERR(priv->clk);
 	}
-	clk_prepare_enable(priv->clk);
 
 	strscpy(priv->adap.name, "hix5hd2-i2c", sizeof(priv->adap.name));
 	priv->dev = &pdev->dev;
@@ -442,7 +441,7 @@ static int hix5hd2_i2c_probe(struct platform_device *pdev)
 			       IRQF_NO_SUSPEND, dev_name(&pdev->dev), priv);
 	if (ret != 0) {
 		dev_err(&pdev->dev, "cannot request HS-I2C IRQ %d\n", irq);
-		goto err_clk;
+		return ret;
 	}
 
 	pm_runtime_set_autosuspend_delay(priv->dev, MSEC_PER_SEC);
@@ -459,8 +458,7 @@ static int hix5hd2_i2c_probe(struct platform_device *pdev)
 err_runtime:
 	pm_runtime_disable(priv->dev);
 	pm_runtime_set_suspended(priv->dev);
-err_clk:
-	clk_disable_unprepare(priv->clk);
+
 	return ret;
 }
 
@@ -471,7 +469,6 @@ static void hix5hd2_i2c_remove(struct platform_device *pdev)
 	i2c_del_adapter(&priv->adap);
 	pm_runtime_disable(priv->dev);
 	pm_runtime_set_suspended(priv->dev);
-	clk_disable_unprepare(priv->clk);
 }
 
 #ifdef CONFIG_PM
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 06/15] i2c: busses: jz4780: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
                   ` (4 preceding siblings ...)
  2023-06-11 22:56 ` [PATCH 05/15] i2c: busses: hix5hd2: " Andi Shyti
@ 2023-06-11 22:56 ` Andi Shyti
  2023-06-23 10:15   ` Wolfram Sang
  2023-06-11 22:56 ` [PATCH 07/15] i2c: busses: lpc2k: " Andi Shyti
                   ` (9 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:56 UTC (permalink / raw)
  To: Linux I2C; +Cc: Andi Shyti, Paul Cercueil

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: Paul Cercueil <paul@crapouillou.net>
---
 drivers/i2c/busses/i2c-jz4780.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c
index 0dfe603995214..7f21611ca3262 100644
--- a/drivers/i2c/busses/i2c-jz4780.c
+++ b/drivers/i2c/busses/i2c-jz4780.c
@@ -792,26 +792,21 @@ static int jz4780_i2c_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, i2c);
 
-	i2c->clk = devm_clk_get(&pdev->dev, NULL);
+	i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(i2c->clk))
 		return PTR_ERR(i2c->clk);
 
-	ret = clk_prepare_enable(i2c->clk);
-	if (ret)
-		return ret;
-
 	ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency",
 				   &clk_freq);
 	if (ret) {
 		dev_err(&pdev->dev, "clock-frequency not specified in DT\n");
-		goto err;
+		return ret;
 	}
 
 	i2c->speed = clk_freq / 1000;
 	if (i2c->speed == 0) {
-		ret = -EINVAL;
 		dev_err(&pdev->dev, "clock-frequency minimum is 1000\n");
-		goto err;
+		return -EINVAL;
 	}
 	jz4780_i2c_set_speed(i2c);
 
@@ -827,22 +822,14 @@ static int jz4780_i2c_probe(struct platform_device *pdev)
 
 	ret = platform_get_irq(pdev, 0);
 	if (ret < 0)
-		goto err;
+		return ret;
 	i2c->irq = ret;
 	ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0,
 			       dev_name(&pdev->dev), i2c);
 	if (ret)
-		goto err;
-
-	ret = i2c_add_adapter(&i2c->adap);
-	if (ret < 0)
-		goto err;
-
-	return 0;
+		return ret;
 
-err:
-	clk_disable_unprepare(i2c->clk);
-	return ret;
+	return i2c_add_adapter(&i2c->adap);
 }
 
 static void jz4780_i2c_remove(struct platform_device *pdev)
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 07/15] i2c: busses: lpc2k: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
                   ` (5 preceding siblings ...)
  2023-06-11 22:56 ` [PATCH 06/15] i2c: busses: jz4780: " Andi Shyti
@ 2023-06-11 22:56 ` Andi Shyti
  2023-06-23 10:16   ` Wolfram Sang
  2023-06-11 22:56 ` [PATCH 08/15] i2c: busses: mt7621: " Andi Shyti
                   ` (8 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:56 UTC (permalink / raw)
  To: Linux I2C; +Cc: Andi Shyti, Vladimir Zapolskiy

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: Vladimir Zapolskiy <vz@mleia.com>
---
 drivers/i2c/busses/i2c-lpc2k.c | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c
index 469fe907723e8..5c6d965547539 100644
--- a/drivers/i2c/busses/i2c-lpc2k.c
+++ b/drivers/i2c/busses/i2c-lpc2k.c
@@ -365,23 +365,17 @@ static int i2c_lpc2k_probe(struct platform_device *pdev)
 
 	init_waitqueue_head(&i2c->wait);
 
-	i2c->clk = devm_clk_get(&pdev->dev, NULL);
+	i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(i2c->clk)) {
-		dev_err(&pdev->dev, "error getting clock\n");
+		dev_err(&pdev->dev, "failed to enable clock.\n");
 		return PTR_ERR(i2c->clk);
 	}
 
-	ret = clk_prepare_enable(i2c->clk);
-	if (ret) {
-		dev_err(&pdev->dev, "unable to enable clock.\n");
-		return ret;
-	}
-
 	ret = devm_request_irq(&pdev->dev, i2c->irq, i2c_lpc2k_handler, 0,
 			       dev_name(&pdev->dev), i2c);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "can't request interrupt.\n");
-		goto fail_clk;
+		return ret;
 	}
 
 	disable_irq_nosync(i2c->irq);
@@ -397,8 +391,7 @@ static int i2c_lpc2k_probe(struct platform_device *pdev)
 	clkrate = clk_get_rate(i2c->clk);
 	if (clkrate == 0) {
 		dev_err(&pdev->dev, "can't get I2C base clock\n");
-		ret = -EINVAL;
-		goto fail_clk;
+		return -EINVAL;
 	}
 
 	/* Setup I2C dividers to generate clock with proper duty cycle */
@@ -424,15 +417,11 @@ static int i2c_lpc2k_probe(struct platform_device *pdev)
 
 	ret = i2c_add_adapter(&i2c->adap);
 	if (ret < 0)
-		goto fail_clk;
+		return ret;
 
 	dev_info(&pdev->dev, "LPC2K I2C adapter\n");
 
 	return 0;
-
-fail_clk:
-	clk_disable_unprepare(i2c->clk);
-	return ret;
 }
 
 static void i2c_lpc2k_remove(struct platform_device *dev)
@@ -440,7 +429,6 @@ static void i2c_lpc2k_remove(struct platform_device *dev)
 	struct lpc2k_i2c *i2c = platform_get_drvdata(dev);
 
 	i2c_del_adapter(&i2c->adap);
-	clk_disable_unprepare(i2c->clk);
 }
 
 #ifdef CONFIG_PM
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 08/15] i2c: busses: mt7621: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
                   ` (6 preceding siblings ...)
  2023-06-11 22:56 ` [PATCH 07/15] i2c: busses: lpc2k: " Andi Shyti
@ 2023-06-11 22:56 ` Andi Shyti
  2023-06-12  3:17   ` Matthias Brugger
                     ` (2 more replies)
  2023-06-11 22:56 ` [PATCH 09/15] i2c: busses: owl: " Andi Shyti
                   ` (7 subsequent siblings)
  15 siblings, 3 replies; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:56 UTC (permalink / raw)
  To: Linux I2C
  Cc: Andi Shyti, Stefan Roese, Matthias Brugger, AngeloGioacchino Del Regno

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: Stefan Roese <sr@denx.de>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/i2c/busses/i2c-mt7621.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mt7621.c b/drivers/i2c/busses/i2c-mt7621.c
index f9c294e2bd3c5..104bb194e9906 100644
--- a/drivers/i2c/busses/i2c-mt7621.c
+++ b/drivers/i2c/busses/i2c-mt7621.c
@@ -282,16 +282,11 @@ static int mtk_i2c_probe(struct platform_device *pdev)
 	if (IS_ERR(i2c->base))
 		return PTR_ERR(i2c->base);
 
-	i2c->clk = devm_clk_get(&pdev->dev, NULL);
+	i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(i2c->clk)) {
-		dev_err(&pdev->dev, "no clock defined\n");
+		dev_err(&pdev->dev, "Failed to enable clock\n");
 		return PTR_ERR(i2c->clk);
 	}
-	ret = clk_prepare_enable(i2c->clk);
-	if (ret) {
-		dev_err(&pdev->dev, "Unable to enable clock\n");
-		return ret;
-	}
 
 	i2c->dev = &pdev->dev;
 
@@ -301,8 +296,7 @@ static int mtk_i2c_probe(struct platform_device *pdev)
 
 	if (i2c->bus_freq == 0) {
 		dev_warn(i2c->dev, "clock-frequency 0 not supported\n");
-		ret = -EINVAL;
-		goto err_disable_clk;
+		return -EINVAL;
 	}
 
 	adap = &i2c->adap;
@@ -320,23 +314,17 @@ static int mtk_i2c_probe(struct platform_device *pdev)
 
 	ret = i2c_add_adapter(adap);
 	if (ret < 0)
-		goto err_disable_clk;
+		return ret;
 
 	dev_info(&pdev->dev, "clock %u kHz\n", i2c->bus_freq / 1000);
 
 	return 0;
-
-err_disable_clk:
-	clk_disable_unprepare(i2c->clk);
-
-	return ret;
 }
 
 static void mtk_i2c_remove(struct platform_device *pdev)
 {
 	struct mtk_i2c *i2c = platform_get_drvdata(pdev);
 
-	clk_disable_unprepare(i2c->clk);
 	i2c_del_adapter(&i2c->adap);
 }
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 09/15] i2c: busses: owl: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
                   ` (7 preceding siblings ...)
  2023-06-11 22:56 ` [PATCH 08/15] i2c: busses: mt7621: " Andi Shyti
@ 2023-06-11 22:56 ` Andi Shyti
  2023-06-23 10:19   ` Wolfram Sang
  2023-06-11 22:56 ` [PATCH 10/15] i2c: busses: pasemi-platform: " Andi Shyti
                   ` (6 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:56 UTC (permalink / raw)
  To: Linux I2C; +Cc: Andi Shyti, Andreas Färber, Manivannan Sadhasivam

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: Andreas Färber <afaerber@suse.de>
Cc: Manivannan Sadhasivam <mani@kernel.org>
---
 drivers/i2c/busses/i2c-owl.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/i2c/busses/i2c-owl.c b/drivers/i2c/busses/i2c-owl.c
index 99ddd88949645..5f0ef8c351418 100644
--- a/drivers/i2c/busses/i2c-owl.c
+++ b/drivers/i2c/busses/i2c-owl.c
@@ -461,21 +461,16 @@ static int owl_i2c_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	i2c_dev->clk = devm_clk_get(dev, NULL);
+	i2c_dev->clk = devm_clk_get_enabled(dev, NULL);
 	if (IS_ERR(i2c_dev->clk)) {
-		dev_err(dev, "failed to get clock\n");
+		dev_err(dev, "failed to enable clock\n");
 		return PTR_ERR(i2c_dev->clk);
 	}
 
-	ret = clk_prepare_enable(i2c_dev->clk);
-	if (ret)
-		return ret;
-
 	i2c_dev->clk_rate = clk_get_rate(i2c_dev->clk);
 	if (!i2c_dev->clk_rate) {
 		dev_err(dev, "input clock rate should not be zero\n");
-		ret = -EINVAL;
-		goto disable_clk;
+		return -EINVAL;
 	}
 
 	init_completion(&i2c_dev->msg_complete);
@@ -496,15 +491,10 @@ static int owl_i2c_probe(struct platform_device *pdev)
 			       i2c_dev);
 	if (ret) {
 		dev_err(dev, "failed to request irq %d\n", irq);
-		goto disable_clk;
+		return ret;
 	}
 
 	return i2c_add_adapter(&i2c_dev->adap);
-
-disable_clk:
-	clk_disable_unprepare(i2c_dev->clk);
-
-	return ret;
 }
 
 static const struct of_device_id owl_i2c_of_match[] = {
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 10/15] i2c: busses: pasemi-platform: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
                   ` (8 preceding siblings ...)
  2023-06-11 22:56 ` [PATCH 09/15] i2c: busses: owl: " Andi Shyti
@ 2023-06-11 22:56 ` Andi Shyti
  2023-06-23  9:56   ` Wolfram Sang
  2023-06-11 22:56 ` [PATCH 11/15] i2c: busses: stm32f4: " Andi Shyti
                   ` (5 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:56 UTC (permalink / raw)
  To: Linux I2C
  Cc: Andi Shyti, Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Hector Martin, Sven Peter, Alyssa Rosenzweig

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: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Hector Martin <marcan@marcan.st>
Cc: Sven Peter <sven@svenpeter.dev>
Cc: Alyssa Rosenzweig <alyssa@rosenzweig.io>
---
 drivers/i2c/busses/i2c-pasemi-platform.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pasemi-platform.c b/drivers/i2c/busses/i2c-pasemi-platform.c
index 0a44f64897c7a..5fbfb9b417440 100644
--- a/drivers/i2c/busses/i2c-pasemi-platform.c
+++ b/drivers/i2c/busses/i2c-pasemi-platform.c
@@ -66,22 +66,18 @@ static int pasemi_platform_i2c_probe(struct platform_device *pdev)
 	if (of_property_read_u32(dev->of_node, "clock-frequency", &frequency))
 		frequency = I2C_MAX_STANDARD_MODE_FREQ;
 
-	data->clk_ref = devm_clk_get(dev, NULL);
+	data->clk_ref = devm_clk_get_enabled(dev, NULL);
 	if (IS_ERR(data->clk_ref))
 		return PTR_ERR(data->clk_ref);
 
-	error = clk_prepare_enable(data->clk_ref);
-	if (error)
-		return error;
-
 	error = pasemi_platform_i2c_calc_clk_div(data, frequency);
 	if (error)
-		goto out_clk_disable;
+		return error;
 
 	smbus->adapter.dev.of_node = pdev->dev.of_node;
 	error = pasemi_i2c_common_probe(smbus);
 	if (error)
-		goto out_clk_disable;
+		return error;
 
 	irq_num = platform_get_irq(pdev, 0);
 	error = devm_request_irq(smbus->dev, irq_num, pasemi_irq_handler, 0, "pasemi_apple_i2c", (void *)smbus);
@@ -91,19 +87,9 @@ static int pasemi_platform_i2c_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, data);
 
 	return 0;
-
-out_clk_disable:
-	clk_disable_unprepare(data->clk_ref);
-
-	return error;
 }
 
-static void pasemi_platform_i2c_remove(struct platform_device *pdev)
-{
-	struct pasemi_platform_i2c_data *data = platform_get_drvdata(pdev);
-
-	clk_disable_unprepare(data->clk_ref);
-}
+static void pasemi_platform_i2c_remove(struct platform_device *pdev) { }
 
 static const struct of_device_id pasemi_platform_i2c_of_match[] = {
 	{ .compatible = "apple,t8103-i2c" },
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 11/15] i2c: busses: stm32f4: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
                   ` (9 preceding siblings ...)
  2023-06-11 22:56 ` [PATCH 10/15] i2c: busses: pasemi-platform: " Andi Shyti
@ 2023-06-11 22:56 ` Andi Shyti
  2023-10-23  8:12   ` Alain Volmat
  2023-10-23 15:30   ` Wolfram Sang
  2023-06-11 22:56 ` [PATCH 12/15] i2c: busses: stm32f7: " Andi Shyti
                   ` (4 subsequent siblings)
  15 siblings, 2 replies; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:56 UTC (permalink / raw)
  To: Linux I2C
  Cc: Andi Shyti, Pierre-Yves MORDRET, Alain Volmat, Maxime Coquelin,
	Alexandre Torgue

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: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>
Cc: Alain Volmat <alain.volmat@foss.st.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
---
 drivers/i2c/busses/i2c-stm32f4.c | 32 ++++++++++----------------------
 1 file changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c
index 6ad06a5a22b43..7bbb0acbdf74d 100644
--- a/drivers/i2c/busses/i2c-stm32f4.c
+++ b/drivers/i2c/busses/i2c-stm32f4.c
@@ -784,23 +784,17 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	i2c_dev->clk = devm_clk_get(&pdev->dev, NULL);
+	i2c_dev->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(i2c_dev->clk)) {
-		dev_err(&pdev->dev, "Error: Missing controller clock\n");
+		dev_err(&pdev->dev, "Failed to enable clock\n");
 		return PTR_ERR(i2c_dev->clk);
 	}
-	ret = clk_prepare_enable(i2c_dev->clk);
-	if (ret) {
-		dev_err(i2c_dev->dev, "Failed to prepare_enable clock\n");
-		return ret;
-	}
 
 	rst = devm_reset_control_get_exclusive(&pdev->dev, NULL);
-	if (IS_ERR(rst)) {
-		ret = dev_err_probe(&pdev->dev, PTR_ERR(rst),
-				    "Error: Missing reset ctrl\n");
-		goto clk_free;
-	}
+	if (IS_ERR(rst))
+		return dev_err_probe(&pdev->dev, PTR_ERR(rst),
+				     "Error: Missing reset ctrl\n");
+
 	reset_control_assert(rst);
 	udelay(2);
 	reset_control_deassert(rst);
@@ -817,7 +811,7 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to request irq event %i\n",
 			irq_event);
-		goto clk_free;
+		return ret;
 	}
 
 	ret = devm_request_irq(&pdev->dev, irq_error, stm32f4_i2c_isr_error, 0,
@@ -825,12 +819,12 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to request irq error %i\n",
 			irq_error);
-		goto clk_free;
+		return ret;
 	}
 
 	ret = stm32f4_i2c_hw_config(i2c_dev);
 	if (ret)
-		goto clk_free;
+		return ret;
 
 	adap = &i2c_dev->adap;
 	i2c_set_adapdata(adap, i2c_dev);
@@ -846,7 +840,7 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
 
 	ret = i2c_add_adapter(adap);
 	if (ret)
-		goto clk_free;
+		return ret;
 
 	platform_set_drvdata(pdev, i2c_dev);
 
@@ -855,10 +849,6 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
 	dev_info(i2c_dev->dev, "STM32F4 I2C driver registered\n");
 
 	return 0;
-
-clk_free:
-	clk_disable_unprepare(i2c_dev->clk);
-	return ret;
 }
 
 static void stm32f4_i2c_remove(struct platform_device *pdev)
@@ -866,8 +856,6 @@ static void stm32f4_i2c_remove(struct platform_device *pdev)
 	struct stm32f4_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
 
 	i2c_del_adapter(&i2c_dev->adap);
-
-	clk_unprepare(i2c_dev->clk);
 }
 
 static const struct of_device_id stm32f4_i2c_match[] = {
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 12/15] i2c: busses: stm32f7: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
                   ` (10 preceding siblings ...)
  2023-06-11 22:56 ` [PATCH 11/15] i2c: busses: stm32f4: " Andi Shyti
@ 2023-06-11 22:56 ` Andi Shyti
  2023-10-23  8:13   ` Alain Volmat
  2023-10-23 15:30   ` Wolfram Sang
  2023-06-11 22:57 ` [PATCH 13/15] i2c: busses: sun6i-p2wi: " Andi Shyti
                   ` (3 subsequent siblings)
  15 siblings, 2 replies; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:56 UTC (permalink / raw)
  To: Linux I2C
  Cc: Andi Shyti, Pierre-Yves MORDRET, Alain Volmat, Maxime Coquelin,
	Alexandre Torgue

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: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>
Cc: Alain Volmat <alain.volmat@foss.st.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
---
 drivers/i2c/busses/i2c-stm32f7.c | 37 +++++++++++---------------------
 1 file changed, 12 insertions(+), 25 deletions(-)

diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index e897d9101434d..e556ba073bc0c 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -2131,23 +2131,16 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
 	i2c_dev->wakeup_src = of_property_read_bool(pdev->dev.of_node,
 						    "wakeup-source");
 
-	i2c_dev->clk = devm_clk_get(&pdev->dev, NULL);
+	i2c_dev->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(i2c_dev->clk))
 		return dev_err_probe(&pdev->dev, PTR_ERR(i2c_dev->clk),
-				     "Failed to get controller clock\n");
-
-	ret = clk_prepare_enable(i2c_dev->clk);
-	if (ret) {
-		dev_err(&pdev->dev, "Failed to prepare_enable clock\n");
-		return ret;
-	}
+				     "Failed to enable controller clock\n");
 
 	rst = devm_reset_control_get(&pdev->dev, NULL);
-	if (IS_ERR(rst)) {
-		ret = dev_err_probe(&pdev->dev, PTR_ERR(rst),
-				    "Error: Missing reset ctrl\n");
-		goto clk_free;
-	}
+	if (IS_ERR(rst))
+		return dev_err_probe(&pdev->dev, PTR_ERR(rst),
+				     "Error: Missing reset ctrl\n");
+
 	reset_control_assert(rst);
 	udelay(2);
 	reset_control_deassert(rst);
@@ -2162,7 +2155,7 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to request irq event %i\n",
 			irq_event);
-		goto clk_free;
+		return ret;
 	}
 
 	ret = devm_request_irq(&pdev->dev, irq_error, stm32f7_i2c_isr_error, 0,
@@ -2170,29 +2163,28 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to request irq error %i\n",
 			irq_error);
-		goto clk_free;
+		return ret;
 	}
 
 	setup = of_device_get_match_data(&pdev->dev);
 	if (!setup) {
 		dev_err(&pdev->dev, "Can't get device data\n");
-		ret = -ENODEV;
-		goto clk_free;
+		return -ENODEV;
 	}
 	i2c_dev->setup = *setup;
 
 	ret = stm32f7_i2c_setup_timing(i2c_dev, &i2c_dev->setup);
 	if (ret)
-		goto clk_free;
+		return ret;
 
 	/* Setup Fast mode plus if necessary */
 	if (i2c_dev->bus_rate > I2C_MAX_FAST_MODE_FREQ) {
 		ret = stm32f7_i2c_setup_fm_plus_bits(pdev, i2c_dev);
 		if (ret)
-			goto clk_free;
+			return ret;
 		ret = stm32f7_i2c_write_fm_plus_bits(i2c_dev, true);
 		if (ret)
-			goto clk_free;
+			return ret;
 	}
 
 	adap = &i2c_dev->adap;
@@ -2303,9 +2295,6 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
 fmp_clear:
 	stm32f7_i2c_write_fm_plus_bits(i2c_dev, false);
 
-clk_free:
-	clk_disable_unprepare(i2c_dev->clk);
-
 	return ret;
 }
 
@@ -2339,8 +2328,6 @@ static void stm32f7_i2c_remove(struct platform_device *pdev)
 	}
 
 	stm32f7_i2c_write_fm_plus_bits(i2c_dev, false);
-
-	clk_disable_unprepare(i2c_dev->clk);
 }
 
 static int __maybe_unused stm32f7_i2c_runtime_suspend(struct device *dev)
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 13/15] i2c: busses: sun6i-p2wi: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
                   ` (11 preceding siblings ...)
  2023-06-11 22:56 ` [PATCH 12/15] i2c: busses: stm32f7: " Andi Shyti
@ 2023-06-11 22:57 ` Andi Shyti
  2023-06-12 18:19   ` Jernej Škrabec
  2023-06-23  9:58   ` Wolfram Sang
  2023-06-11 22:57 ` [PATCH 14/15] i2c: busses: uniphier-f: " Andi Shyti
                   ` (2 subsequent siblings)
  15 siblings, 2 replies; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:57 UTC (permalink / raw)
  To: Linux I2C; +Cc: Andi Shyti, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland

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: Chen-Yu Tsai <wens@csie.org>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: Samuel Holland <samuel@sholland.org>
---
 drivers/i2c/busses/i2c-sun6i-p2wi.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/i2c/busses/i2c-sun6i-p2wi.c b/drivers/i2c/busses/i2c-sun6i-p2wi.c
index 3cff1afe0caa2..ad8270cdbd3eb 100644
--- a/drivers/i2c/busses/i2c-sun6i-p2wi.c
+++ b/drivers/i2c/busses/i2c-sun6i-p2wi.c
@@ -239,15 +239,9 @@ static int p2wi_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
-	p2wi->clk = devm_clk_get(dev, NULL);
+	p2wi->clk = devm_clk_get_enabled(dev, NULL);
 	if (IS_ERR(p2wi->clk)) {
 		ret = PTR_ERR(p2wi->clk);
-		dev_err(dev, "failed to retrieve clk: %d\n", ret);
-		return ret;
-	}
-
-	ret = clk_prepare_enable(p2wi->clk);
-	if (ret) {
 		dev_err(dev, "failed to enable clk: %d\n", ret);
 		return ret;
 	}
@@ -256,15 +250,14 @@ static int p2wi_probe(struct platform_device *pdev)
 
 	p2wi->rstc = devm_reset_control_get_exclusive(dev, NULL);
 	if (IS_ERR(p2wi->rstc)) {
-		ret = PTR_ERR(p2wi->rstc);
 		dev_err(dev, "failed to retrieve reset controller: %d\n", ret);
-		goto err_clk_disable;
+		return PTR_ERR(p2wi->rstc);
 	}
 
 	ret = reset_control_deassert(p2wi->rstc);
 	if (ret) {
 		dev_err(dev, "failed to deassert reset line: %d\n", ret);
-		goto err_clk_disable;
+		return ret;
 	}
 
 	init_completion(&p2wi->complete);
@@ -307,9 +300,6 @@ static int p2wi_probe(struct platform_device *pdev)
 err_reset_assert:
 	reset_control_assert(p2wi->rstc);
 
-err_clk_disable:
-	clk_disable_unprepare(p2wi->clk);
-
 	return ret;
 }
 
@@ -318,7 +308,6 @@ static void p2wi_remove(struct platform_device *dev)
 	struct p2wi *p2wi = platform_get_drvdata(dev);
 
 	reset_control_assert(p2wi->rstc);
-	clk_disable_unprepare(p2wi->clk);
 	i2c_del_adapter(&p2wi->adapter);
 }
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 14/15] i2c: busses: uniphier-f: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
                   ` (12 preceding siblings ...)
  2023-06-11 22:57 ` [PATCH 13/15] i2c: busses: sun6i-p2wi: " Andi Shyti
@ 2023-06-11 22:57 ` Andi Shyti
  2023-06-23 10:22   ` Wolfram Sang
  2023-06-11 22:57 ` [PATCH 15/15] i2c: busses: uniphier: " Andi Shyti
  2023-06-12 12:58 ` [PATCH 10/15] i2c: busses: pasemi-platform: " alyssa
  15 siblings, 1 reply; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:57 UTC (permalink / raw)
  To: Linux I2C; +Cc: Andi Shyti, Kunihiko Hayashi, Masami Hiramatsu

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: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
---
 drivers/i2c/busses/i2c-uniphier-f.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c
index 54b1624ef87ea..dbc91c7c3788f 100644
--- a/drivers/i2c/busses/i2c-uniphier-f.c
+++ b/drivers/i2c/busses/i2c-uniphier-f.c
@@ -540,21 +540,16 @@ static int uniphier_fi2c_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	priv->clk = devm_clk_get(dev, NULL);
+	priv->clk = devm_clk_get_enabled(dev, NULL);
 	if (IS_ERR(priv->clk)) {
-		dev_err(dev, "failed to get clock\n");
+		dev_err(dev, "failed to enable clock\n");
 		return PTR_ERR(priv->clk);
 	}
 
-	ret = clk_prepare_enable(priv->clk);
-	if (ret)
-		return ret;
-
 	clk_rate = clk_get_rate(priv->clk);
 	if (!clk_rate) {
 		dev_err(dev, "input clock rate should not be zero\n");
-		ret = -EINVAL;
-		goto disable_clk;
+		return -EINVAL;
 	}
 
 	priv->clk_cycle = clk_rate / bus_speed;
@@ -575,15 +570,10 @@ static int uniphier_fi2c_probe(struct platform_device *pdev)
 			       pdev->name, priv);
 	if (ret) {
 		dev_err(dev, "failed to request irq %d\n", irq);
-		goto disable_clk;
+		return ret;
 	}
 
-	ret = i2c_add_adapter(&priv->adap);
-disable_clk:
-	if (ret)
-		clk_disable_unprepare(priv->clk);
-
-	return ret;
+	return i2c_add_adapter(&priv->adap);
 }
 
 static void uniphier_fi2c_remove(struct platform_device *pdev)
@@ -591,7 +581,6 @@ static void uniphier_fi2c_remove(struct platform_device *pdev)
 	struct uniphier_fi2c_priv *priv = platform_get_drvdata(pdev);
 
 	i2c_del_adapter(&priv->adap);
-	clk_disable_unprepare(priv->clk);
 }
 
 static int __maybe_unused uniphier_fi2c_suspend(struct device *dev)
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 15/15] i2c: busses: uniphier: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
                   ` (13 preceding siblings ...)
  2023-06-11 22:57 ` [PATCH 14/15] i2c: busses: uniphier-f: " Andi Shyti
@ 2023-06-11 22:57 ` Andi Shyti
  2023-06-23 10:23   ` Wolfram Sang
  2023-06-12 12:58 ` [PATCH 10/15] i2c: busses: pasemi-platform: " alyssa
  15 siblings, 1 reply; 46+ messages in thread
From: Andi Shyti @ 2023-06-11 22:57 UTC (permalink / raw)
  To: Linux I2C; +Cc: Andi Shyti, Kunihiko Hayashi, Masami Hiramatsu

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: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
---
 drivers/i2c/busses/i2c-uniphier.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c
index 96b1eb7489a3c..854ac25b58628 100644
--- a/drivers/i2c/busses/i2c-uniphier.c
+++ b/drivers/i2c/busses/i2c-uniphier.c
@@ -335,21 +335,16 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	priv->clk = devm_clk_get(dev, NULL);
+	priv->clk = devm_clk_get_enabled(dev, NULL);
 	if (IS_ERR(priv->clk)) {
-		dev_err(dev, "failed to get clock\n");
+		dev_err(dev, "failed to enable clock\n");
 		return PTR_ERR(priv->clk);
 	}
 
-	ret = clk_prepare_enable(priv->clk);
-	if (ret)
-		return ret;
-
 	clk_rate = clk_get_rate(priv->clk);
 	if (!clk_rate) {
 		dev_err(dev, "input clock rate should not be zero\n");
-		ret = -EINVAL;
-		goto disable_clk;
+		return -EINVAL;
 	}
 
 	priv->clk_cycle = clk_rate / bus_speed;
@@ -369,15 +364,10 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
 			       priv);
 	if (ret) {
 		dev_err(dev, "failed to request irq %d\n", irq);
-		goto disable_clk;
+		return ret;
 	}
 
-	ret = i2c_add_adapter(&priv->adap);
-disable_clk:
-	if (ret)
-		clk_disable_unprepare(priv->clk);
-
-	return ret;
+	return i2c_add_adapter(&priv->adap);
 }
 
 static void uniphier_i2c_remove(struct platform_device *pdev)
@@ -385,7 +375,6 @@ static void uniphier_i2c_remove(struct platform_device *pdev)
 	struct uniphier_i2c_priv *priv = platform_get_drvdata(pdev);
 
 	i2c_del_adapter(&priv->adap);
-	clk_disable_unprepare(priv->clk);
 }
 
 static int __maybe_unused uniphier_i2c_suspend(struct device *dev)
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: [PATCH 08/15] i2c: busses: mt7621: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 08/15] i2c: busses: mt7621: " Andi Shyti
@ 2023-06-12  3:17   ` Matthias Brugger
  2023-06-12  8:43   ` Stefan Roese
  2023-06-23  9:55   ` Wolfram Sang
  2 siblings, 0 replies; 46+ messages in thread
From: Matthias Brugger @ 2023-06-12  3:17 UTC (permalink / raw)
  To: Andi Shyti, Linux I2C; +Cc: Stefan Roese, AngeloGioacchino Del Regno



On 12/06/2023 00:56, Andi Shyti wrote:
> 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: Stefan Roese <sr@denx.de>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

> ---
>   drivers/i2c/busses/i2c-mt7621.c | 20 ++++----------------
>   1 file changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mt7621.c b/drivers/i2c/busses/i2c-mt7621.c
> index f9c294e2bd3c5..104bb194e9906 100644
> --- a/drivers/i2c/busses/i2c-mt7621.c
> +++ b/drivers/i2c/busses/i2c-mt7621.c
> @@ -282,16 +282,11 @@ static int mtk_i2c_probe(struct platform_device *pdev)
>   	if (IS_ERR(i2c->base))
>   		return PTR_ERR(i2c->base);
>   
> -	i2c->clk = devm_clk_get(&pdev->dev, NULL);
> +	i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL);
>   	if (IS_ERR(i2c->clk)) {
> -		dev_err(&pdev->dev, "no clock defined\n");
> +		dev_err(&pdev->dev, "Failed to enable clock\n");
>   		return PTR_ERR(i2c->clk);
>   	}
> -	ret = clk_prepare_enable(i2c->clk);
> -	if (ret) {
> -		dev_err(&pdev->dev, "Unable to enable clock\n");
> -		return ret;
> -	}
>   
>   	i2c->dev = &pdev->dev;
>   
> @@ -301,8 +296,7 @@ static int mtk_i2c_probe(struct platform_device *pdev)
>   
>   	if (i2c->bus_freq == 0) {
>   		dev_warn(i2c->dev, "clock-frequency 0 not supported\n");
> -		ret = -EINVAL;
> -		goto err_disable_clk;
> +		return -EINVAL;
>   	}
>   
>   	adap = &i2c->adap;
> @@ -320,23 +314,17 @@ static int mtk_i2c_probe(struct platform_device *pdev)
>   
>   	ret = i2c_add_adapter(adap);
>   	if (ret < 0)
> -		goto err_disable_clk;
> +		return ret;
>   
>   	dev_info(&pdev->dev, "clock %u kHz\n", i2c->bus_freq / 1000);
>   
>   	return 0;
> -
> -err_disable_clk:
> -	clk_disable_unprepare(i2c->clk);
> -
> -	return ret;
>   }
>   
>   static void mtk_i2c_remove(struct platform_device *pdev)
>   {
>   	struct mtk_i2c *i2c = platform_get_drvdata(pdev);
>   
> -	clk_disable_unprepare(i2c->clk);
>   	i2c_del_adapter(&i2c->adap);
>   }
>   

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 01/15] i2c: busses: emev2: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 01/15] i2c: busses: emev2: " Andi Shyti
@ 2023-06-12  7:11   ` Geert Uytterhoeven
  2023-06-12  7:54     ` Andi Shyti
  0 siblings, 1 reply; 46+ messages in thread
From: Geert Uytterhoeven @ 2023-06-12  7:11 UTC (permalink / raw)
  To: Andi Shyti; +Cc: Linux I2C, Wolfram Sang, Geert Uytterhoeven, Magnus Damm

Hi Andi,

On Mon, Jun 12, 2023 at 12:57 AM Andi Shyti <andi.shyti@kernel.org> wrote:
> 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: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Magnus Damm <magnus.damm@gmail.com>

Thanks for your patch!

> --- a/drivers/i2c/busses/i2c-emev2.c
> +++ b/drivers/i2c/busses/i2c-emev2.c
> @@ -373,14 +373,10 @@ static int em_i2c_probe(struct platform_device *pdev)
>
>         strscpy(priv->adap.name, "EMEV2 I2C", sizeof(priv->adap.name));
>
> -       priv->sclk = devm_clk_get(&pdev->dev, "sclk");
> +       priv->sclk = devm_clk_get_enabled(&pdev->dev, "sclk");
>         if (IS_ERR(priv->sclk))
>                 return PTR_ERR(priv->sclk);

After this, priv->sclk is unused, so you can replace em_i2c_device.sclk
by a local variable.

The rest LGTM.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 01/15] i2c: busses: emev2: Use devm_clk_get_enabled()
  2023-06-12  7:11   ` Geert Uytterhoeven
@ 2023-06-12  7:54     ` Andi Shyti
  0 siblings, 0 replies; 46+ messages in thread
From: Andi Shyti @ 2023-06-12  7:54 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linux I2C, Wolfram Sang, Geert Uytterhoeven, Magnus Damm

Hi Geert,

> > --- a/drivers/i2c/busses/i2c-emev2.c
> > +++ b/drivers/i2c/busses/i2c-emev2.c
> > @@ -373,14 +373,10 @@ static int em_i2c_probe(struct platform_device *pdev)
> >
> >         strscpy(priv->adap.name, "EMEV2 I2C", sizeof(priv->adap.name));
> >
> > -       priv->sclk = devm_clk_get(&pdev->dev, "sclk");
> > +       priv->sclk = devm_clk_get_enabled(&pdev->dev, "sclk");
> >         if (IS_ERR(priv->sclk))
> >                 return PTR_ERR(priv->sclk);
> 
> After this, priv->sclk is unused, so you can replace em_i2c_device.sclk
> by a local variable.

good point! Will send it again. Thanks!

Andi

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/15] i2c: busses: xiic: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 02/15] i2c: busses: xiic: " Andi Shyti
@ 2023-06-12  8:07   ` Michal Simek
  2023-06-23  9:54   ` Wolfram Sang
  1 sibling, 0 replies; 46+ messages in thread
From: Michal Simek @ 2023-06-12  8:07 UTC (permalink / raw)
  To: Andi Shyti, Linux I2C



On 6/12/23 00:56, Andi Shyti wrote:
> 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: Michal Simek <michal.simek@amd.com>
> ---
>   drivers/i2c/busses/i2c-xiic.c | 20 +++++++-------------
>   1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 61288f8dd0672..f879af4def5ed 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -1256,16 +1256,11 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>   
>   	mutex_init(&i2c->lock);
>   
> -	i2c->clk = devm_clk_get(&pdev->dev, NULL);
> +	i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL);
>   	if (IS_ERR(i2c->clk))
>   		return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk),
> -				     "input clock not found.\n");
> +				     "failed to enable input clock.\n");
>   
> -	ret = clk_prepare_enable(i2c->clk);
> -	if (ret) {
> -		dev_err(&pdev->dev, "Unable to enable clock.\n");
> -		return ret;
> -	}
>   	i2c->dev = &pdev->dev;
>   	pm_runtime_set_autosuspend_delay(i2c->dev, XIIC_PM_TIMEOUT);
>   	pm_runtime_use_autosuspend(i2c->dev);
> @@ -1286,7 +1281,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>   
>   	if (ret < 0) {
>   		dev_err(&pdev->dev, "Cannot claim IRQ\n");
> -		goto err_clk_dis;
> +		goto err_pm_disable;
>   	}
>   
>   	i2c->singlemaster =
> @@ -1307,14 +1302,14 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>   	ret = xiic_reinit(i2c);
>   	if (ret < 0) {
>   		dev_err(&pdev->dev, "Cannot xiic_reinit\n");
> -		goto err_clk_dis;
> +		goto err_pm_disable;
>   	}
>   
>   	/* add i2c adapter to i2c tree */
>   	ret = i2c_add_adapter(&i2c->adap);
>   	if (ret) {
>   		xiic_deinit(i2c);
> -		goto err_clk_dis;
> +		goto err_pm_disable;
>   	}
>   
>   	if (pdata) {
> @@ -1328,10 +1323,10 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>   
>   	return 0;
>   
> -err_clk_dis:
> +err_pm_disable:
>   	pm_runtime_set_suspended(&pdev->dev);
>   	pm_runtime_disable(&pdev->dev);
> -	clk_disable_unprepare(i2c->clk);
> +
>   	return ret;
>   }
>   
> @@ -1352,7 +1347,6 @@ static void xiic_i2c_remove(struct platform_device *pdev)
>   		xiic_deinit(i2c);
>   
>   	pm_runtime_put_sync(i2c->dev);
> -	clk_disable_unprepare(i2c->clk);
>   	pm_runtime_disable(&pdev->dev);
>   	pm_runtime_set_suspended(&pdev->dev);
>   	pm_runtime_dont_use_autosuspend(&pdev->dev);

Acked-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 08/15] i2c: busses: mt7621: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 08/15] i2c: busses: mt7621: " Andi Shyti
  2023-06-12  3:17   ` Matthias Brugger
@ 2023-06-12  8:43   ` Stefan Roese
  2023-06-23  9:55   ` Wolfram Sang
  2 siblings, 0 replies; 46+ messages in thread
From: Stefan Roese @ 2023-06-12  8:43 UTC (permalink / raw)
  To: Andi Shyti, Linux I2C; +Cc: Matthias Brugger, AngeloGioacchino Del Regno

On 6/12/23 00:56, Andi Shyti wrote:
> 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: Stefan Roese <sr@denx.de>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   drivers/i2c/busses/i2c-mt7621.c | 20 ++++----------------
>   1 file changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mt7621.c b/drivers/i2c/busses/i2c-mt7621.c
> index f9c294e2bd3c5..104bb194e9906 100644
> --- a/drivers/i2c/busses/i2c-mt7621.c
> +++ b/drivers/i2c/busses/i2c-mt7621.c
> @@ -282,16 +282,11 @@ static int mtk_i2c_probe(struct platform_device *pdev)
>   	if (IS_ERR(i2c->base))
>   		return PTR_ERR(i2c->base);
>   
> -	i2c->clk = devm_clk_get(&pdev->dev, NULL);
> +	i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL);
>   	if (IS_ERR(i2c->clk)) {
> -		dev_err(&pdev->dev, "no clock defined\n");
> +		dev_err(&pdev->dev, "Failed to enable clock\n");
>   		return PTR_ERR(i2c->clk);
>   	}
> -	ret = clk_prepare_enable(i2c->clk);
> -	if (ret) {
> -		dev_err(&pdev->dev, "Unable to enable clock\n");
> -		return ret;
> -	}
>   
>   	i2c->dev = &pdev->dev;
>   
> @@ -301,8 +296,7 @@ static int mtk_i2c_probe(struct platform_device *pdev)
>   
>   	if (i2c->bus_freq == 0) {
>   		dev_warn(i2c->dev, "clock-frequency 0 not supported\n");
> -		ret = -EINVAL;
> -		goto err_disable_clk;
> +		return -EINVAL;
>   	}
>   
>   	adap = &i2c->adap;
> @@ -320,23 +314,17 @@ static int mtk_i2c_probe(struct platform_device *pdev)
>   
>   	ret = i2c_add_adapter(adap);
>   	if (ret < 0)
> -		goto err_disable_clk;
> +		return ret;
>   
>   	dev_info(&pdev->dev, "clock %u kHz\n", i2c->bus_freq / 1000);
>   
>   	return 0;
> -
> -err_disable_clk:
> -	clk_disable_unprepare(i2c->clk);
> -
> -	return ret;
>   }
>   
>   static void mtk_i2c_remove(struct platform_device *pdev)
>   {
>   	struct mtk_i2c *i2c = platform_get_drvdata(pdev);
>   
> -	clk_disable_unprepare(i2c->clk);
>   	i2c_del_adapter(&i2c->adap);
>   }
>   

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 10/15] i2c: busses: pasemi-platform: Use devm_clk_get_enabled()
  2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
                   ` (14 preceding siblings ...)
  2023-06-11 22:57 ` [PATCH 15/15] i2c: busses: uniphier: " Andi Shyti
@ 2023-06-12 12:58 ` alyssa
  15 siblings, 0 replies; 46+ messages in thread
From: alyssa @ 2023-06-12 12:58 UTC (permalink / raw)
  To: Andi Shyti, Linux I2C
  Cc: Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Hector Martin, Sven Peter

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>

June 11, 2023 6:56 PM, "Andi Shyti" <andi.shyti@kernel.org> wrote:

> 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: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: Hector Martin <marcan@marcan.st>
> Cc: Sven Peter <sven@svenpeter.dev>
> Cc: Alyssa Rosenzweig <alyssa@rosenzweig.io>
> ---
> drivers/i2c/busses/i2c-pasemi-platform.c | 22 ++++------------------
> 1 file changed, 4 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-pasemi-platform.c b/drivers/i2c/busses/i2c-pasemi-platform.c
> index 0a44f64897c7a..5fbfb9b417440 100644
> --- a/drivers/i2c/busses/i2c-pasemi-platform.c
> +++ b/drivers/i2c/busses/i2c-pasemi-platform.c
> @@ -66,22 +66,18 @@ static int pasemi_platform_i2c_probe(struct platform_device *pdev)
> if (of_property_read_u32(dev->of_node, "clock-frequency", &frequency))
> frequency = I2C_MAX_STANDARD_MODE_FREQ;
> 
> - data->clk_ref = devm_clk_get(dev, NULL);
> + data->clk_ref = devm_clk_get_enabled(dev, NULL);
> if (IS_ERR(data->clk_ref))
> return PTR_ERR(data->clk_ref);
> 
> - error = clk_prepare_enable(data->clk_ref);
> - if (error)
> - return error;
> -
> error = pasemi_platform_i2c_calc_clk_div(data, frequency);
> if (error)
> - goto out_clk_disable;
> + return error;
> 
> smbus->adapter.dev.of_node = pdev->dev.of_node;
> error = pasemi_i2c_common_probe(smbus);
> if (error)
> - goto out_clk_disable;
> + return error;
> 
> irq_num = platform_get_irq(pdev, 0);
> error = devm_request_irq(smbus->dev, irq_num, pasemi_irq_handler, 0, "pasemi_apple_i2c", (void
> *)smbus);
> @@ -91,19 +87,9 @@ static int pasemi_platform_i2c_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, data);
> 
> return 0;
> -
> -out_clk_disable:
> - clk_disable_unprepare(data->clk_ref);
> -
> - return error;
> }
> 
> -static void pasemi_platform_i2c_remove(struct platform_device *pdev)
> -{
> - struct pasemi_platform_i2c_data *data = platform_get_drvdata(pdev);
> -
> - clk_disable_unprepare(data->clk_ref);
> -}
> +static void pasemi_platform_i2c_remove(struct platform_device *pdev) { }
> 
> static const struct of_device_id pasemi_platform_i2c_of_match[] = {
> { .compatible = "apple,t8103-i2c" },
> -- 
> 2.40.1

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 13/15] i2c: busses: sun6i-p2wi: Use devm_clk_get_enabled()
  2023-06-11 22:57 ` [PATCH 13/15] i2c: busses: sun6i-p2wi: " Andi Shyti
@ 2023-06-12 18:19   ` Jernej Škrabec
  2023-06-23  9:58   ` Wolfram Sang
  1 sibling, 0 replies; 46+ messages in thread
From: Jernej Škrabec @ 2023-06-12 18:19 UTC (permalink / raw)
  To: Linux I2C, Andi Shyti; +Cc: Andi Shyti, Chen-Yu Tsai, Samuel Holland

Dne ponedeljek, 12. junij 2023 ob 00:57:00 CEST je Andi Shyti napisal(a):
> 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: Chen-Yu Tsai <wens@csie.org>
> Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
> Cc: Samuel Holland <samuel@sholland.org>

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/15] i2c: busses: xiic: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 02/15] i2c: busses: xiic: " Andi Shyti
  2023-06-12  8:07   ` Michal Simek
@ 2023-06-23  9:54   ` Wolfram Sang
  1 sibling, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-06-23  9:54 UTC (permalink / raw)
  To: Andi Shyti; +Cc: Linux I2C, Michal Simek

[-- Attachment #1: Type: text/plain, Size: 394 bytes --]

On Mon, Jun 12, 2023 at 12:56:49AM +0200, Andi Shyti wrote:
> 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: Michal Simek <michal.simek@amd.com>

Applied to for-next, thanks! No need for 'busses' in $subject, tough. I
removed it while applying.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 08/15] i2c: busses: mt7621: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 08/15] i2c: busses: mt7621: " Andi Shyti
  2023-06-12  3:17   ` Matthias Brugger
  2023-06-12  8:43   ` Stefan Roese
@ 2023-06-23  9:55   ` Wolfram Sang
  2 siblings, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-06-23  9:55 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Linux I2C, Stefan Roese, Matthias Brugger, AngeloGioacchino Del Regno

[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

On Mon, Jun 12, 2023 at 12:56:55AM +0200, Andi Shyti wrote:
> 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: Stefan Roese <sr@denx.de>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 10/15] i2c: busses: pasemi-platform: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 10/15] i2c: busses: pasemi-platform: " Andi Shyti
@ 2023-06-23  9:56   ` Wolfram Sang
  0 siblings, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-06-23  9:56 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Linux I2C, Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Hector Martin, Sven Peter, Alyssa Rosenzweig

[-- Attachment #1: Type: text/plain, Size: 549 bytes --]

On Mon, Jun 12, 2023 at 12:56:57AM +0200, Andi Shyti wrote:
> 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: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: Hector Martin <marcan@marcan.st>
> Cc: Sven Peter <sven@svenpeter.dev>
> Cc: Alyssa Rosenzweig <alyssa@rosenzweig.io>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 13/15] i2c: busses: sun6i-p2wi: Use devm_clk_get_enabled()
  2023-06-11 22:57 ` [PATCH 13/15] i2c: busses: sun6i-p2wi: " Andi Shyti
  2023-06-12 18:19   ` Jernej Škrabec
@ 2023-06-23  9:58   ` Wolfram Sang
  1 sibling, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-06-23  9:58 UTC (permalink / raw)
  To: Andi Shyti; +Cc: Linux I2C, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland

[-- Attachment #1: Type: text/plain, Size: 409 bytes --]

On Mon, Jun 12, 2023 at 12:57:00AM +0200, Andi Shyti wrote:
> 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: Chen-Yu Tsai <wens@csie.org>
> Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
> Cc: Samuel Holland <samuel@sholland.org>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 04/15] i2c: busses: exynos5: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 04/15] i2c: busses: exynos5: " Andi Shyti
@ 2023-06-23 10:03   ` Wolfram Sang
  2023-06-23 11:48     ` Andi Shyti
  0 siblings, 1 reply; 46+ messages in thread
From: Wolfram Sang @ 2023-06-23 10:03 UTC (permalink / raw)
  To: Andi Shyti; +Cc: Linux I2C, Krzysztof Kozlowski, Alim Akhtar

[-- Attachment #1: Type: text/plain, Size: 185 bytes --]


> -	clk_unprepare(i2c->clk);
> -	clk_unprepare(i2c->pclk);

Are you sure we can use devm_clk_get_enabled() here which calls
clk_disable_unprepare() on remove and not clk_unprepare()?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 05/15] i2c: busses: hix5hd2: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 05/15] i2c: busses: hix5hd2: " Andi Shyti
@ 2023-06-23 10:09   ` Wolfram Sang
  0 siblings, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-06-23 10:09 UTC (permalink / raw)
  To: Andi Shyti; +Cc: Linux I2C

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

On Mon, Jun 12, 2023 at 12:56:52AM +0200, Andi Shyti wrote:
> 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>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 06/15] i2c: busses: jz4780: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 06/15] i2c: busses: jz4780: " Andi Shyti
@ 2023-06-23 10:15   ` Wolfram Sang
  0 siblings, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-06-23 10:15 UTC (permalink / raw)
  To: Andi Shyti; +Cc: Linux I2C, Paul Cercueil

[-- Attachment #1: Type: text/plain, Size: 106 bytes --]


>  static void jz4780_i2c_remove(struct platform_device *pdev)

You did not update the remove function.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 07/15] i2c: busses: lpc2k: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 07/15] i2c: busses: lpc2k: " Andi Shyti
@ 2023-06-23 10:16   ` Wolfram Sang
  0 siblings, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-06-23 10:16 UTC (permalink / raw)
  To: Andi Shyti; +Cc: Linux I2C, Vladimir Zapolskiy

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]

On Mon, Jun 12, 2023 at 12:56:54AM +0200, Andi Shyti wrote:
> 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: Vladimir Zapolskiy <vz@mleia.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 09/15] i2c: busses: owl: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 09/15] i2c: busses: owl: " Andi Shyti
@ 2023-06-23 10:19   ` Wolfram Sang
  0 siblings, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-06-23 10:19 UTC (permalink / raw)
  To: Andi Shyti; +Cc: Linux I2C, Andreas Färber, Manivannan Sadhasivam

[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

On Mon, Jun 12, 2023 at 12:56:56AM +0200, Andi Shyti wrote:
> 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: Andreas Färber <afaerber@suse.de>
> Cc: Manivannan Sadhasivam <mani@kernel.org>

Applied to for-next, thanks! But I still wonder why this driver does not
have a remove function?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 14/15] i2c: busses: uniphier-f: Use devm_clk_get_enabled()
  2023-06-11 22:57 ` [PATCH 14/15] i2c: busses: uniphier-f: " Andi Shyti
@ 2023-06-23 10:22   ` Wolfram Sang
  0 siblings, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-06-23 10:22 UTC (permalink / raw)
  To: Andi Shyti; +Cc: Linux I2C, Kunihiko Hayashi, Masami Hiramatsu

[-- Attachment #1: Type: text/plain, Size: 383 bytes --]

On Mon, Jun 12, 2023 at 12:57:01AM +0200, Andi Shyti wrote:
> 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: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> Cc: Masami Hiramatsu <mhiramat@kernel.org>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 15/15] i2c: busses: uniphier: Use devm_clk_get_enabled()
  2023-06-11 22:57 ` [PATCH 15/15] i2c: busses: uniphier: " Andi Shyti
@ 2023-06-23 10:23   ` Wolfram Sang
  0 siblings, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-06-23 10:23 UTC (permalink / raw)
  To: Andi Shyti; +Cc: Linux I2C, Kunihiko Hayashi, Masami Hiramatsu

[-- Attachment #1: Type: text/plain, Size: 383 bytes --]

On Mon, Jun 12, 2023 at 12:57:02AM +0200, Andi Shyti wrote:
> 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: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> Cc: Masami Hiramatsu <mhiramat@kernel.org>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 03/15] i2c: busses: at91-core: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 03/15] i2c: busses: at91-core: " Andi Shyti
@ 2023-06-23 10:23   ` Wolfram Sang
  2023-06-23 14:21     ` Nicolas Ferre
  2023-06-23 14:38   ` Nicolas Ferre
  2023-10-21 18:35   ` Wolfram Sang
  2 siblings, 1 reply; 46+ messages in thread
From: Wolfram Sang @ 2023-06-23 10:23 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Linux I2C, Codrin Ciubotariu, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

On Mon, Jun 12, 2023 at 12:56:50AM +0200, Andi Shyti wrote:
> 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>

Nicolas, did you find a new maintainer for this driver?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 04/15] i2c: busses: exynos5: Use devm_clk_get_enabled()
  2023-06-23 10:03   ` Wolfram Sang
@ 2023-06-23 11:48     ` Andi Shyti
  2023-06-23 12:18       ` Krzysztof Kozlowski
  2023-06-23 12:29       ` Wolfram Sang
  0 siblings, 2 replies; 46+ messages in thread
From: Andi Shyti @ 2023-06-23 11:48 UTC (permalink / raw)
  To: Wolfram Sang, Linux I2C, Krzysztof Kozlowski, Alim Akhtar

On Fri, Jun 23, 2023 at 12:03:56PM +0200, Wolfram Sang wrote:
> 
> > -	clk_unprepare(i2c->clk);
> > -	clk_unprepare(i2c->pclk);
> 
> Are you sure we can use devm_clk_get_enabled() here which calls
> clk_disable_unprepare() on remove and not clk_unprepare()?

Unless I am missing something, I think so. This is what the
driver does, gets the clock and enables it.

I don't know why there is just unprepare() and not
disable_unprepare() in this function.

I think the patch is correct, maybe Krzysztof and Alim might spot
something that I have missed.

Thanks,
Andi

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 04/15] i2c: busses: exynos5: Use devm_clk_get_enabled()
  2023-06-23 11:48     ` Andi Shyti
@ 2023-06-23 12:18       ` Krzysztof Kozlowski
  2023-06-23 12:30         ` Andi Shyti
  2023-06-23 12:29       ` Wolfram Sang
  1 sibling, 1 reply; 46+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-23 12:18 UTC (permalink / raw)
  To: Andi Shyti, Wolfram Sang, Linux I2C, Alim Akhtar

On 23/06/2023 13:48, Andi Shyti wrote:
> On Fri, Jun 23, 2023 at 12:03:56PM +0200, Wolfram Sang wrote:
>>
>>> -	clk_unprepare(i2c->clk);
>>> -	clk_unprepare(i2c->pclk);
>>
>> Are you sure we can use devm_clk_get_enabled() here which calls
>> clk_disable_unprepare() on remove and not clk_unprepare()?
> 
> Unless I am missing something, I think so. This is what the
> driver does, gets the clock and enables it.
> 
> I don't know why there is just unprepare() and not
> disable_unprepare() in this function.

Your code is not equivalent and does not explain why. Pure
devm_clk_get_enabled() conversion should be equivalent.

If original code was correct, your patch will cause double clk disable.
If original code was not correct, your patch silently fixes it without
explaining that there was a bug.

Did you test the patch, including the unbind path?

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 04/15] i2c: busses: exynos5: Use devm_clk_get_enabled()
  2023-06-23 11:48     ` Andi Shyti
  2023-06-23 12:18       ` Krzysztof Kozlowski
@ 2023-06-23 12:29       ` Wolfram Sang
  1 sibling, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-06-23 12:29 UTC (permalink / raw)
  To: Andi Shyti; +Cc: Linux I2C, Krzysztof Kozlowski, Alim Akhtar

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]


> I don't know why there is just unprepare() and not
> disable_unprepare() in this function.

To save power, some drivers disable the clock by default (after some
init in probe) and only enable it when a transaction is on-going. If
they do everything right(tm), they may only need to unprepare the clock
in remove. I don't know the details about the exynos driver, though.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 04/15] i2c: busses: exynos5: Use devm_clk_get_enabled()
  2023-06-23 12:18       ` Krzysztof Kozlowski
@ 2023-06-23 12:30         ` Andi Shyti
  0 siblings, 0 replies; 46+ messages in thread
From: Andi Shyti @ 2023-06-23 12:30 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Wolfram Sang, Linux I2C, Alim Akhtar

Hi Krzysztof,

On Fri, Jun 23, 2023 at 02:18:32PM +0200, Krzysztof Kozlowski wrote:
> On 23/06/2023 13:48, Andi Shyti wrote:
> > On Fri, Jun 23, 2023 at 12:03:56PM +0200, Wolfram Sang wrote:
> >>
> >>> -	clk_unprepare(i2c->clk);
> >>> -	clk_unprepare(i2c->pclk);
> >>
> >> Are you sure we can use devm_clk_get_enabled() here which calls
> >> clk_disable_unprepare() on remove and not clk_unprepare()?
> > 
> > Unless I am missing something, I think so. This is what the
> > driver does, gets the clock and enables it.
> > 
> > I don't know why there is just unprepare() and not
> > disable_unprepare() in this function.
> 
> Your code is not equivalent and does not explain why. Pure
> devm_clk_get_enabled() conversion should be equivalent.
> 
> If original code was correct, your patch will cause double clk disable.
> If original code was not correct, your patch silently fixes it without
> explaining that there was a bug.
> 
> Did you test the patch, including the unbind path?

you are right! My code, indeed, doesn't do a 1to1 conversion.

Will prepare it again, maybe in two patches, one for the
conversion and one for clearing the removal path.

Thanks for dropping in,
Andi

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 03/15] i2c: busses: at91-core: Use devm_clk_get_enabled()
  2023-06-23 10:23   ` Wolfram Sang
@ 2023-06-23 14:21     ` Nicolas Ferre
  0 siblings, 0 replies; 46+ messages in thread
From: Nicolas Ferre @ 2023-06-23 14:21 UTC (permalink / raw)
  To: Wolfram Sang, Andi Shyti, Linux I2C, Durai Manickam
  Cc: Claudiu Beznea, Alexandre Belloni

Wolfram,

On 23/06/2023 at 12:23, Wolfram Sang wrote:
> 
> On Mon, Jun 12, 2023 at 12:56:50AM +0200, Andi Shyti wrote:
>> 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>
> Nicolas, did you find a new maintainer for this driver?

You can contact Durai in "to" of this email. I can have a look if needed 
as well. Thanks for the heads-up!

Best regards,
  Nicolas

-- 
Nicolas Ferre


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 03/15] i2c: busses: at91-core: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 03/15] i2c: busses: at91-core: " Andi Shyti
  2023-06-23 10:23   ` Wolfram Sang
@ 2023-06-23 14:38   ` Nicolas Ferre
  2023-10-21 18:35   ` Wolfram Sang
  2 siblings, 0 replies; 46+ messages in thread
From: Nicolas Ferre @ 2023-06-23 14:38 UTC (permalink / raw)
  To: Andi Shyti, Linux I2C; +Cc: Alexandre Belloni, Claudiu Beznea, Durai Manickam

On 12/06/2023 at 00:56, Andi Shyti wrote:
> 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>

Looks good to me:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Best regards,
   Nicolas

> 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
> 

-- 
Nicolas Ferre


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 03/15] i2c: busses: at91-core: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 03/15] i2c: busses: at91-core: " Andi Shyti
  2023-06-23 10:23   ` Wolfram Sang
  2023-06-23 14:38   ` Nicolas Ferre
@ 2023-10-21 18:35   ` Wolfram Sang
  2 siblings, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-10-21 18:35 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Linux I2C, Codrin Ciubotariu, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

On Mon, Jun 12, 2023 at 12:56:50AM +0200, Andi Shyti wrote:
> 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>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 11/15] i2c: busses: stm32f4: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 11/15] i2c: busses: stm32f4: " Andi Shyti
@ 2023-10-23  8:12   ` Alain Volmat
  2023-10-23 15:30   ` Wolfram Sang
  1 sibling, 0 replies; 46+ messages in thread
From: Alain Volmat @ 2023-10-23  8:12 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Linux I2C, Pierre-Yves MORDRET, Maxime Coquelin, Alexandre Torgue

Hi Andi,

sorry for the delay.

On Mon, Jun 12, 2023 at 12:56:58AM +0200, Andi Shyti wrote:
> 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: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>
> Cc: Alain Volmat <alain.volmat@foss.st.com>
> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
> ---
>  drivers/i2c/busses/i2c-stm32f4.c | 32 ++++++++++----------------------
>  1 file changed, 10 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c
> index 6ad06a5a22b43..7bbb0acbdf74d 100644
> --- a/drivers/i2c/busses/i2c-stm32f4.c
> +++ b/drivers/i2c/busses/i2c-stm32f4.c
> @@ -784,23 +784,17 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> -	i2c_dev->clk = devm_clk_get(&pdev->dev, NULL);
> +	i2c_dev->clk = devm_clk_get_enabled(&pdev->dev, NULL);
>  	if (IS_ERR(i2c_dev->clk)) {
> -		dev_err(&pdev->dev, "Error: Missing controller clock\n");
> +		dev_err(&pdev->dev, "Failed to enable clock\n");
>  		return PTR_ERR(i2c_dev->clk);
>  	}
> -	ret = clk_prepare_enable(i2c_dev->clk);
> -	if (ret) {
> -		dev_err(i2c_dev->dev, "Failed to prepare_enable clock\n");
> -		return ret;
> -	}
>  
>  	rst = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> -	if (IS_ERR(rst)) {
> -		ret = dev_err_probe(&pdev->dev, PTR_ERR(rst),
> -				    "Error: Missing reset ctrl\n");
> -		goto clk_free;
> -	}
> +	if (IS_ERR(rst))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(rst),
> +				     "Error: Missing reset ctrl\n");
> +
>  	reset_control_assert(rst);
>  	udelay(2);
>  	reset_control_deassert(rst);
> @@ -817,7 +811,7 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to request irq event %i\n",
>  			irq_event);
> -		goto clk_free;
> +		return ret;
>  	}
>  
>  	ret = devm_request_irq(&pdev->dev, irq_error, stm32f4_i2c_isr_error, 0,
> @@ -825,12 +819,12 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to request irq error %i\n",
>  			irq_error);
> -		goto clk_free;
> +		return ret;
>  	}
>  
>  	ret = stm32f4_i2c_hw_config(i2c_dev);
>  	if (ret)
> -		goto clk_free;
> +		return ret;
>  
>  	adap = &i2c_dev->adap;
>  	i2c_set_adapdata(adap, i2c_dev);
> @@ -846,7 +840,7 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
>  
>  	ret = i2c_add_adapter(adap);
>  	if (ret)
> -		goto clk_free;
> +		return ret;
>  
>  	platform_set_drvdata(pdev, i2c_dev);
>  
> @@ -855,10 +849,6 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
>  	dev_info(i2c_dev->dev, "STM32F4 I2C driver registered\n");
>  
>  	return 0;
> -
> -clk_free:
> -	clk_disable_unprepare(i2c_dev->clk);
> -	return ret;
>  }
>  
>  static void stm32f4_i2c_remove(struct platform_device *pdev)
> @@ -866,8 +856,6 @@ static void stm32f4_i2c_remove(struct platform_device *pdev)
>  	struct stm32f4_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
>  
>  	i2c_del_adapter(&i2c_dev->adap);
> -
> -	clk_unprepare(i2c_dev->clk);
>  }
>  
>  static const struct of_device_id stm32f4_i2c_match[] = {
> -- 
> 2.40.1
> 

Acked-by: Alain Volmat <alain.volmat@foss.st.com>

Regards,
Alain

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 12/15] i2c: busses: stm32f7: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 12/15] i2c: busses: stm32f7: " Andi Shyti
@ 2023-10-23  8:13   ` Alain Volmat
  2023-10-23 15:30   ` Wolfram Sang
  1 sibling, 0 replies; 46+ messages in thread
From: Alain Volmat @ 2023-10-23  8:13 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Linux I2C, Pierre-Yves MORDRET, Maxime Coquelin, Alexandre Torgue

Hi Andi,

sorry for the delay.

On Mon, Jun 12, 2023 at 12:56:59AM +0200, Andi Shyti wrote:
> 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: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>
> Cc: Alain Volmat <alain.volmat@foss.st.com>
> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
> ---
>  drivers/i2c/busses/i2c-stm32f7.c | 37 +++++++++++---------------------
>  1 file changed, 12 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
> index e897d9101434d..e556ba073bc0c 100644
> --- a/drivers/i2c/busses/i2c-stm32f7.c
> +++ b/drivers/i2c/busses/i2c-stm32f7.c
> @@ -2131,23 +2131,16 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
>  	i2c_dev->wakeup_src = of_property_read_bool(pdev->dev.of_node,
>  						    "wakeup-source");
>  
> -	i2c_dev->clk = devm_clk_get(&pdev->dev, NULL);
> +	i2c_dev->clk = devm_clk_get_enabled(&pdev->dev, NULL);
>  	if (IS_ERR(i2c_dev->clk))
>  		return dev_err_probe(&pdev->dev, PTR_ERR(i2c_dev->clk),
> -				     "Failed to get controller clock\n");
> -
> -	ret = clk_prepare_enable(i2c_dev->clk);
> -	if (ret) {
> -		dev_err(&pdev->dev, "Failed to prepare_enable clock\n");
> -		return ret;
> -	}
> +				     "Failed to enable controller clock\n");
>  
>  	rst = devm_reset_control_get(&pdev->dev, NULL);
> -	if (IS_ERR(rst)) {
> -		ret = dev_err_probe(&pdev->dev, PTR_ERR(rst),
> -				    "Error: Missing reset ctrl\n");
> -		goto clk_free;
> -	}
> +	if (IS_ERR(rst))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(rst),
> +				     "Error: Missing reset ctrl\n");
> +
>  	reset_control_assert(rst);
>  	udelay(2);
>  	reset_control_deassert(rst);
> @@ -2162,7 +2155,7 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to request irq event %i\n",
>  			irq_event);
> -		goto clk_free;
> +		return ret;
>  	}
>  
>  	ret = devm_request_irq(&pdev->dev, irq_error, stm32f7_i2c_isr_error, 0,
> @@ -2170,29 +2163,28 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to request irq error %i\n",
>  			irq_error);
> -		goto clk_free;
> +		return ret;
>  	}
>  
>  	setup = of_device_get_match_data(&pdev->dev);
>  	if (!setup) {
>  		dev_err(&pdev->dev, "Can't get device data\n");
> -		ret = -ENODEV;
> -		goto clk_free;
> +		return -ENODEV;
>  	}
>  	i2c_dev->setup = *setup;
>  
>  	ret = stm32f7_i2c_setup_timing(i2c_dev, &i2c_dev->setup);
>  	if (ret)
> -		goto clk_free;
> +		return ret;
>  
>  	/* Setup Fast mode plus if necessary */
>  	if (i2c_dev->bus_rate > I2C_MAX_FAST_MODE_FREQ) {
>  		ret = stm32f7_i2c_setup_fm_plus_bits(pdev, i2c_dev);
>  		if (ret)
> -			goto clk_free;
> +			return ret;
>  		ret = stm32f7_i2c_write_fm_plus_bits(i2c_dev, true);
>  		if (ret)
> -			goto clk_free;
> +			return ret;
>  	}
>  
>  	adap = &i2c_dev->adap;
> @@ -2303,9 +2295,6 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
>  fmp_clear:
>  	stm32f7_i2c_write_fm_plus_bits(i2c_dev, false);
>  
> -clk_free:
> -	clk_disable_unprepare(i2c_dev->clk);
> -
>  	return ret;
>  }
>  
> @@ -2339,8 +2328,6 @@ static void stm32f7_i2c_remove(struct platform_device *pdev)
>  	}
>  
>  	stm32f7_i2c_write_fm_plus_bits(i2c_dev, false);
> -
> -	clk_disable_unprepare(i2c_dev->clk);
>  }
>  
>  static int __maybe_unused stm32f7_i2c_runtime_suspend(struct device *dev)
> -- 
> 2.40.1
> 

Acked-by: Alain Volmat <alain.volmat@foss.st.com>

Regards,
Alain

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 11/15] i2c: busses: stm32f4: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 11/15] i2c: busses: stm32f4: " Andi Shyti
  2023-10-23  8:12   ` Alain Volmat
@ 2023-10-23 15:30   ` Wolfram Sang
  1 sibling, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-10-23 15:30 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Linux I2C, Pierre-Yves MORDRET, Alain Volmat, Maxime Coquelin,
	Alexandre Torgue

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

On Mon, Jun 12, 2023 at 12:56:58AM +0200, Andi Shyti wrote:
> 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: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>
> Cc: Alain Volmat <alain.volmat@foss.st.com>
> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 12/15] i2c: busses: stm32f7: Use devm_clk_get_enabled()
  2023-06-11 22:56 ` [PATCH 12/15] i2c: busses: stm32f7: " Andi Shyti
  2023-10-23  8:13   ` Alain Volmat
@ 2023-10-23 15:30   ` Wolfram Sang
  1 sibling, 0 replies; 46+ messages in thread
From: Wolfram Sang @ 2023-10-23 15:30 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Linux I2C, Pierre-Yves MORDRET, Alain Volmat, Maxime Coquelin,
	Alexandre Torgue

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

On Mon, Jun 12, 2023 at 12:56:59AM +0200, Andi Shyti wrote:
> 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: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>
> Cc: Alain Volmat <alain.volmat@foss.st.com>
> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2023-10-23 15:30 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-11 22:56 [PATCH 00/15] i2c: busses: Use devm_clk_get_enabled() Andi Shyti
2023-06-11 22:56 ` [PATCH 01/15] i2c: busses: emev2: " Andi Shyti
2023-06-12  7:11   ` Geert Uytterhoeven
2023-06-12  7:54     ` Andi Shyti
2023-06-11 22:56 ` [PATCH 02/15] i2c: busses: xiic: " Andi Shyti
2023-06-12  8:07   ` Michal Simek
2023-06-23  9:54   ` Wolfram Sang
2023-06-11 22:56 ` [PATCH 03/15] i2c: busses: at91-core: " Andi Shyti
2023-06-23 10:23   ` Wolfram Sang
2023-06-23 14:21     ` Nicolas Ferre
2023-06-23 14:38   ` Nicolas Ferre
2023-10-21 18:35   ` Wolfram Sang
2023-06-11 22:56 ` [PATCH 04/15] i2c: busses: exynos5: " Andi Shyti
2023-06-23 10:03   ` Wolfram Sang
2023-06-23 11:48     ` Andi Shyti
2023-06-23 12:18       ` Krzysztof Kozlowski
2023-06-23 12:30         ` Andi Shyti
2023-06-23 12:29       ` Wolfram Sang
2023-06-11 22:56 ` [PATCH 05/15] i2c: busses: hix5hd2: " Andi Shyti
2023-06-23 10:09   ` Wolfram Sang
2023-06-11 22:56 ` [PATCH 06/15] i2c: busses: jz4780: " Andi Shyti
2023-06-23 10:15   ` Wolfram Sang
2023-06-11 22:56 ` [PATCH 07/15] i2c: busses: lpc2k: " Andi Shyti
2023-06-23 10:16   ` Wolfram Sang
2023-06-11 22:56 ` [PATCH 08/15] i2c: busses: mt7621: " Andi Shyti
2023-06-12  3:17   ` Matthias Brugger
2023-06-12  8:43   ` Stefan Roese
2023-06-23  9:55   ` Wolfram Sang
2023-06-11 22:56 ` [PATCH 09/15] i2c: busses: owl: " Andi Shyti
2023-06-23 10:19   ` Wolfram Sang
2023-06-11 22:56 ` [PATCH 10/15] i2c: busses: pasemi-platform: " Andi Shyti
2023-06-23  9:56   ` Wolfram Sang
2023-06-11 22:56 ` [PATCH 11/15] i2c: busses: stm32f4: " Andi Shyti
2023-10-23  8:12   ` Alain Volmat
2023-10-23 15:30   ` Wolfram Sang
2023-06-11 22:56 ` [PATCH 12/15] i2c: busses: stm32f7: " Andi Shyti
2023-10-23  8:13   ` Alain Volmat
2023-10-23 15:30   ` Wolfram Sang
2023-06-11 22:57 ` [PATCH 13/15] i2c: busses: sun6i-p2wi: " Andi Shyti
2023-06-12 18:19   ` Jernej Škrabec
2023-06-23  9:58   ` Wolfram Sang
2023-06-11 22:57 ` [PATCH 14/15] i2c: busses: uniphier-f: " Andi Shyti
2023-06-23 10:22   ` Wolfram Sang
2023-06-11 22:57 ` [PATCH 15/15] i2c: busses: uniphier: " Andi Shyti
2023-06-23 10:23   ` Wolfram Sang
2023-06-12 12:58 ` [PATCH 10/15] i2c: busses: pasemi-platform: " alyssa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.