i2c: busses: Use devm_clk_get_enabled()
Subsystems (17)
Andi Shyti
maintainercover i2c: busses: Use devm_clk_get_enabled()
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(-)
Signature · 1 line
2.40.1
Andi Shyti
maintainerPATCH 1/15 i2c: busses: emev2: Use devm_clk_get_enabled()
Replace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled().
--- drivers/i2c/busses/i2c-emev2.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/i2c/busses/i2c-emev2.c +4 -13
@@ -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[] = {
Signature · 1 line
2.40.1
Re: [PATCH 01/15] i2c: busses: emev2: Use devm_clk_get_enabled()
Hi Andi,
Quoted 8 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Wolfram Sang <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Magnus Damm <[email protected]>
Thanks for your patch!
drivers/i2c/busses/i2c-emev2.c static int em_i2c_probe(struct platform_device *pdev) · line 378
Quoted 10 lines
drivers/i2c/busses/i2c-emev2.c +1
-1@@ -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
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Andi Shyti
maintainerRe: [PATCH 01/15] i2c: busses: emev2: Use devm_clk_get_enabled()
Hi Geert,
Quoted 6 lines
Quoted 6 lines
drivers/i2c/busses/i2c-emev2.c +0
-0@@ -373,14 +373,10 @@ static int em_i2c_probe(struct platform_device *pdev)strscpy (priv->adap.name,"EMEV2 I2C" ,sizeof (priv->adap.name));
Quoted 7 lines
drivers/i2c/busses/i2c-emev2.c static int em_i2c_probe(struct platform_device *pdev) · line 378
Quoted 4 lines
drivers/i2c/busses/i2c-emev2.c +1
-1- 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->sclkis unused, so you can replace em_i2c_device.sclk by a local variable.
good point! Will send it again. Thanks!
Andi
Andi Shyti
maintainerPATCH 2/15 i2c: busses: xiic: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().
--- drivers/i2c/busses/i2c-xiic.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
drivers/i2c/busses/i2c-xiic.c +7 -13
@@ -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);
Signature · 1 line
2.40.1
Re: [PATCH 02/15] i2c: busses: xiic: Use devm_clk_get_enabled()
Quoted 73 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Michal Simek <[email protected]>--- drivers/i2c/busses/i2c-xiic.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)drivers/i2c/busses/i2c-xiic.c +7
-12@@ -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; }
drivers/i2c/busses/i2c-xiic.c static void xiic_i2c_remove(struct platform_device *pdev) · line 1352
Quoted 7 lines
drivers/i2c/busses/i2c-xiic.c +0
-1@@ -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);
Thanks,
Michal
Wolfram Sang
AppliedRe: [PATCH 02/15] i2c: busses: xiic: Use devm_clk_get_enabled()
In reply to Andi ShytiQuoted 6 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Michal Simek <[email protected]>
Applied to for-next, thanks! No need for 'busses' in $subject, tough. I removed it while applying.
Andi Shyti
maintainerPATCH 3/15 i2c: busses: at91-core: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled().
--- drivers/i2c/busses/i2c-at91-core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-at91-core.c +2 -6
@@ -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);
Signature · 1 line
2.40.1
Re: [PATCH 03/15] i2c: busses: at91-core: Use devm_clk_get_enabled()
Quoted 9 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Codrin Ciubotariu <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Claudiu Beznea <[email protected]>
Nicolas, did you find a new maintainer for this driver?
Nicolas Ferre
maintainerRe: [PATCH 03/15] i2c: busses: at91-core: Use devm_clk_get_enabled()
Wolfram,
Quoted 6 lines · Wolfram Sang
Quoted 4 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().
Quoted 6 lines
Quoted 5 lines
Signed-off-by Andi Shyti<[email protected]>Cc Codrin Ciubotariu<[email protected]>Cc Nicolas Ferre<[email protected]>Cc Alexandre Belloni<[email protected]>Cc Claudiu Beznea<[email protected]>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
Signature · 1 line
Nicolas Ferre
Re: [PATCH 03/15] i2c: busses: at91-core: Use devm_clk_get_enabled()
In reply to Andi ShytiQuoted 7 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Codrin Ciubotariu <[email protected]>Cc Nicolas Ferre <[email protected]>
Looks good to me:
Best regards,
Nicolas
Quoted 45 lines
Cc Alexandre Belloni <[email protected]>Cc Claudiu Beznea <[email protected]>--- drivers/i2c/busses/i2c-at91-core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/i2c/busses/i2c-at91-core.c +2
-7@@ -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
Signature · 1 line
Nicolas Ferre
Wolfram Sang
AppliedRe: [PATCH 03/15] i2c: busses: at91-core: Use devm_clk_get_enabled()
In reply to Andi ShytiQuoted 9 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Codrin Ciubotariu <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Claudiu Beznea <[email protected]>
Applied to for-next, thanks!
Andi Shyti
maintainerPATCH 4/15 i2c: busses: exynos5: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled().
--- drivers/i2c/busses/i2c-exynos5.c | 44 +++++++++----------------------- 1 file changed, 12 insertions(+), 32 deletions(-)
drivers/i2c/busses/i2c-exynos5.c +12 -32
@@ -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
Signature · 1 line
2.40.1
Re: [PATCH 04/15] i2c: busses: exynos5: Use devm_clk_get_enabled()
drivers/i2c/busses/i2c-exynos5.c static void exynos5_i2c_remove(struct platform_device *pdev) · line 892
Quoted 3 lines
drivers/i2c/busses/i2c-exynos5.c +0
-2-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()?
Andi Shyti
maintainerRe: [PATCH 04/15] i2c: busses: exynos5: Use devm_clk_get_enabled()
Quoted 6 lines · Wolfram Sang
drivers/i2c/busses/i2c-exynos5.c static void exynos5_i2c_remove(struct platform_device *pdev) · line 892
Quoted 3 lines
drivers/i2c/busses/i2c-exynos5.c +0
-2-clk_unprepare (i2c->clk); -clk_unprepare (i2c->pclk);Are you sure we can use
devm_clk_get_enabled()here which callsclk_disable_unprepare()on remove and notclk_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
Re: [PATCH 04/15] i2c: busses: exynos5: Use devm_clk_get_enabled()
Quoted 8 lines · Andi Shyti
Quoted 6 lines · Wolfram Sang
drivers/i2c/busses/i2c-exynos5.c static void exynos5_i2c_remove(struct platform_device *pdev) · line 892
Quoted 3 lines
drivers/i2c/busses/i2c-exynos5.c +0
-2-clk_unprepare (i2c->clk); -clk_unprepare (i2c->pclk);Are you sure we can use
devm_clk_get_enabled()here which callsclk_disable_unprepare()on remove and notclk_unprepare()?
Quoted 5 lines
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 notdisable_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
Andi Shyti
maintainerRe: [PATCH 04/15] i2c: busses: exynos5: Use devm_clk_get_enabled()
Hi Krzysztof,
Quoted 15 lines · Krzysztof Kozlowski
Quoted 8 lines · Andi Shyti
Quoted 6 lines · Wolfram Sang
drivers/i2c/busses/i2c-exynos5.c static void exynos5_i2c_remove(struct platform_device *pdev) · line 892
Quoted 3 lines
drivers/i2c/busses/i2c-exynos5.c +0
-2-clk_unprepare (i2c->clk); -clk_unprepare (i2c->pclk);Are you sure we can use
devm_clk_get_enabled()here which callsclk_disable_unprepare()on remove and notclk_unprepare()?Quoted 5 lines
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 notdisable_unprepare()in this function.
Quoted 8 lines
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
Re: [PATCH 04/15] i2c: busses: exynos5: Use devm_clk_get_enabled()
In reply to Andi ShytiQuoted 3 lines
I don't know why there is just
unprepare()and notdisable_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.
Andi Shyti
maintainerPATCH 5/15 i2c: busses: hix5hd2: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().
--- drivers/i2c/busses/i2c-hix5hd2.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-hix5hd2.c +4 -7
@@ -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
Signature · 1 line
2.40.1
Wolfram Sang
AppliedRe: [PATCH 05/15] i2c: busses: hix5hd2: Use devm_clk_get_enabled()
Quoted 5 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>
Applied to for-next, thanks!
Andi Shyti
maintainerPATCH 6/15 i2c: busses: jz4780: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().
--- drivers/i2c/busses/i2c-jz4780.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-)
drivers/i2c/busses/i2c-jz4780.c +6 -19
@@ -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)
Signature · 1 line
2.40.1
Re: [PATCH 06/15] i2c: busses: jz4780: Use devm_clk_get_enabled()
Quoted 2 lines
static void
jz4780_i2c_remove(struct platform_device *pdev)
You did not update the remove function.
Andi Shyti
maintainerPATCH 7/15 i2c: busses: lpc2k: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().
--- drivers/i2c/busses/i2c-lpc2k.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)
drivers/i2c/busses/i2c-lpc2k.c +5 -17
@@ -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
Signature · 1 line
2.40.1
Wolfram Sang
AppliedRe: [PATCH 07/15] i2c: busses: lpc2k: Use devm_clk_get_enabled()
Quoted 6 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Vladimir Zapolskiy <[email protected]>
Applied to for-next, thanks!
Andi Shyti
maintainerPATCH 8/15 i2c: busses: mt7621: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled().
--- drivers/i2c/busses/i2c-mt7621.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
drivers/i2c/busses/i2c-mt7621.c +4 -16
@@ -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); }
Signature · 1 line
2.40.1
Re: [PATCH 08/15] i2c: busses: mt7621: Use devm_clk_get_enabled()
Quoted 8 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Stefan Roese <[email protected]>Cc Matthias Brugger <[email protected]>Cc AngeloGioacchino Del Regno <[email protected]>
Quoted 62 lines
--- drivers/i2c/busses/i2c-mt7621.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)drivers/i2c/busses/i2c-mt7621.c +4
-16@@ -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); }
Re: [PATCH 08/15] i2c: busses: mt7621: Use devm_clk_get_enabled()
In reply to Andi ShytiQuoted 8 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Stefan Roese <[email protected]>Cc Matthias Brugger <[email protected]>Cc AngeloGioacchino Del Regno <[email protected]>
Thanks,
Stefan
Quoted 52 lines
--- drivers/i2c/busses/i2c-mt7621.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)drivers/i2c/busses/i2c-mt7621.c +4
-15@@ -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;
drivers/i2c/busses/i2c-mt7621.c static int mtk_i2c_probe(struct platform_device *pdev) · line 330
Quoted 10 lines
drivers/i2c/busses/i2c-mt7621.c +0
-1}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
Signature · 3 lines
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: [email protected]
Wolfram Sang
AppliedRe: [PATCH 08/15] i2c: busses: mt7621: Use devm_clk_get_enabled()
In reply to Andi ShytiQuoted 8 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Stefan Roese <[email protected]>Cc Matthias Brugger <[email protected]>Cc AngeloGioacchino Del Regno <[email protected]>
Applied to for-next, thanks!
Andi Shyti
maintainerPATCH 9/15 i2c: busses: owl: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled().
--- drivers/i2c/busses/i2c-owl.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/i2c/busses/i2c-owl.c +4 -14
@@ -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[] = {
Signature · 1 line
2.40.1
Wolfram Sang
AppliedRe: [PATCH 09/15] i2c: busses: owl: Use devm_clk_get_enabled()
Quoted 7 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Andreas Färber <[email protected]>Cc Manivannan Sadhasivam <[email protected]>
Applied to for-next, thanks! But I still wonder why this driver does not have a remove function?
Andi Shyti
maintainerPATCH 10/15 i2c: busses: pasemi-platform: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled().
--- drivers/i2c/busses/i2c-pasemi-platform.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-)
drivers/i2c/busses/i2c-pasemi-platform.c +4 -18
@@ -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" },
Signature · 1 line
2.40.1
Re: [PATCH 10/15] i2c: busses: pasemi-platform: Use devm_clk_get_enabled()
Quoted 69 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Michael Ellerman <[email protected]>Cc Nicholas Piggin <[email protected]>Cc Christophe Leroy <[email protected]>Cc Hector Martin <[email protected]>Cc Sven Peter <[email protected]>Cc Alyssa Rosenzweig <[email protected]>---
drivers/i2c/busses/i2c-pasemi-platform.c| 22 ++++------------------1 file changed, 4 insertions(+), 18 deletions(-)drivers/i2c/busses/i2c-pasemi-platform.c +3
-7@@ -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);drivers/i2c/busses/i2c-pasemi-platform.c +1
-11@@ -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" },Signature · 1 line
2.40.1
Wolfram Sang
AppliedRe: [PATCH 10/15] i2c: busses: pasemi-platform: Use devm_clk_get_enabled()
In reply to Andi ShytiQuoted 11 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Michael Ellerman <[email protected]>Cc Nicholas Piggin <[email protected]>Cc Christophe Leroy <[email protected]>Cc Hector Martin <[email protected]>Cc Sven Peter <[email protected]>Cc Alyssa Rosenzweig <[email protected]>
Applied to for-next, thanks!
Andi Shyti
maintainerPATCH 11/15 i2c: busses: stm32f4: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled().
--- drivers/i2c/busses/i2c-stm32f4.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)
drivers/i2c/busses/i2c-stm32f4.c +10 -22
@@ -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[] = {
Signature · 1 line
2.40.1
Re: [PATCH 11/15] i2c: busses: stm32f4: Use devm_clk_get_enabled()
Hi Andi,
sorry for the delay.
Quoted 103 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Pierre-Yves MORDRET <[email protected]>Cc Alain Volmat <[email protected]>Cc Maxime Coquelin <[email protected]>Cc Alexandre Torgue <[email protected]>--- drivers/i2c/busses/i2c-stm32f4.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)drivers/i2c/busses/i2c-stm32f4.c +10
-22@@ -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[] = {Signature · 1 line
2.40.1
Regards,
Alain
Wolfram Sang
AppliedRe: [PATCH 11/15] i2c: busses: stm32f4: Use devm_clk_get_enabled()
In reply to Andi ShytiQuoted 9 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Pierre-Yves MORDRET <[email protected]>Cc Alain Volmat <[email protected]>Cc Maxime Coquelin <[email protected]>Cc Alexandre Torgue <[email protected]>
Applied to for-next, thanks!
Andi Shyti
maintainerPATCH 12/15 i2c: busses: stm32f7: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled().
--- drivers/i2c/busses/i2c-stm32f7.c | 37 +++++++++++--------------------- 1 file changed, 12 insertions(+), 25 deletions(-)
drivers/i2c/busses/i2c-stm32f7.c +12 -25
@@ -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)
Signature · 1 line
2.40.1
Re: [PATCH 12/15] i2c: busses: stm32f7: Use devm_clk_get_enabled()
Hi Andi,
sorry for the delay.
Quoted 113 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Pierre-Yves MORDRET <[email protected]>Cc Alain Volmat <[email protected]>Cc Maxime Coquelin <[email protected]>Cc Alexandre Torgue <[email protected]>--- drivers/i2c/busses/i2c-stm32f7.c | 37 +++++++++++--------------------- 1 file changed, 12 insertions(+), 25 deletions(-)drivers/i2c/busses/i2c-stm32f7.c +12
-25@@ -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)Signature · 1 line
2.40.1
Regards,
Alain
Wolfram Sang
AppliedRe: [PATCH 12/15] i2c: busses: stm32f7: Use devm_clk_get_enabled()
In reply to Andi ShytiQuoted 9 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Pierre-Yves MORDRET <[email protected]>Cc Alain Volmat <[email protected]>Cc Maxime Coquelin <[email protected]>Cc Alexandre Torgue <[email protected]>
Applied to for-next, thanks!
Andi Shyti
maintainerPATCH 13/15 i2c: busses: sun6i-p2wi: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled().
--- drivers/i2c/busses/i2c-sun6i-p2wi.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/i2c/busses/i2c-sun6i-p2wi.c +3 -14
@@ -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); }
Signature · 1 line
2.40.1
Re: [PATCH 13/15] i2c: busses: sun6i-p2wi: Use devm_clk_get_enabled()
Dne ponedeljek, 12. junij 2023 ob 00:57:00 CEST je Andi Shyti napisal(a):
Quoted 8 lines
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Chen-Yu Tsai <[email protected]>Cc Jernej Skrabec <[email protected]>Cc Samuel Holland <[email protected]>
Best regards,
Jernej
Wolfram Sang
AppliedRe: [PATCH 13/15] i2c: busses: sun6i-p2wi: Use devm_clk_get_enabled()
In reply to Andi ShytiQuoted 8 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Chen-Yu Tsai <[email protected]>Cc Jernej Skrabec <[email protected]>Cc Samuel Holland <[email protected]>
Applied to for-next, thanks!
Andi Shyti
maintainerPATCH 14/15 i2c: busses: uniphier-f: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled().
--- drivers/i2c/busses/i2c-uniphier-f.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-)
drivers/i2c/busses/i2c-uniphier-f.c +5 -16
@@ -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)
Signature · 1 line
2.40.1
Wolfram Sang
AppliedRe: [PATCH 14/15] i2c: busses: uniphier-f: Use devm_clk_get_enabled()
Quoted 7 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Kunihiko Hayashi <[email protected]>Cc Masami Hiramatsu <[email protected]>
Applied to for-next, thanks!
Andi Shyti
maintainerPATCH 15/15 i2c: busses: uniphier: Use devm_clk_get_enabled()
In reply to Andi ShytiReplace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled().
--- drivers/i2c/busses/i2c-uniphier.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-)
drivers/i2c/busses/i2c-uniphier.c +5 -16
@@ -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)
Signature · 1 line
2.40.1
Wolfram Sang
AppliedRe: [PATCH 15/15] i2c: busses: uniphier: Use devm_clk_get_enabled()
Quoted 7 lines · Andi Shyti
Replace the pair of functions,
devm_clk_get()andclk_prepare_enable(), with a single functiondevm_clk_get_enabled().Signed-off-by Andi Shyti <[email protected]>Cc Kunihiko Hayashi <[email protected]>Cc Masami Hiramatsu <[email protected]>
Applied to for-next, thanks!