diff mbox series

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

Message ID 20230611225702.891856-4-andi.shyti@kernel.org
State New
Headers show
Series i2c: busses: Use devm_clk_get_enabled() | expand

Commit Message

Andi Shyti June 11, 2023, 10:56 p.m. UTC
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(-)

Comments

Wolfram Sang June 23, 2023, 10:23 a.m. UTC | #1
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?
Nicolas Ferre June 23, 2023, 2:21 p.m. UTC | #2
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 June 23, 2023, 2:38 p.m. UTC | #3
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
>
Wolfram Sang Oct. 21, 2023, 6:35 p.m. UTC | #4
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!
diff mbox series

Patch

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