Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1322134 > unrolled thread

[PATCH] i2c: designware: balance clk enable/disable on removal

Started byAlexey Khoroshilov <khoroshilov@ispras.ru>
First post2016-01-29 23:40 +0100
Last post2016-02-01 15:50 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] i2c: designware: balance clk enable/disable on removal Alexey Khoroshilov <khoroshilov@ispras.ru> - 2016-01-29 23:40 +0100
    Re: [PATCH] i2c: designware: balance clk enable/disable on removal Jarkko Nikula <jarkko.nikula@linux.intel.com> - 2016-02-01 15:30 +0100
      Re: [PATCH] i2c: designware: balance clk enable/disable on removal Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-01 15:50 +0100

#1322134 — [PATCH] i2c: designware: balance clk enable/disable on removal

FromAlexey Khoroshilov <khoroshilov@ispras.ru>
Date2016-01-29 23:40 +0100
Subject[PATCH] i2c: designware: balance clk enable/disable on removal
Message-ID<qWpRT-1uc-5@gated-at.bofh.it>
It seems clk_disable_unprepare() is missed in dw_i2c_plat_remove(),
so the patch adds it.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 438f1b4964c0..8f19b7b81fe0 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -267,6 +267,7 @@ static int dw_i2c_plat_remove(struct platform_device *pdev)
 	i2c_del_adapter(&dev->adapter);
 
 	i2c_dw_disable(dev);
+	i2c_dw_plat_prepare_clk(dev, false);
 
 	pm_runtime_dont_use_autosuspend(&pdev->dev);
 	pm_runtime_put_sync(&pdev->dev);
-- 
1.9.1

[toc] | [next] | [standalone]


#1323170

FromJarkko Nikula <jarkko.nikula@linux.intel.com>
Date2016-02-01 15:30 +0100
Message-ID<qXnEp-45e-81@gated-at.bofh.it>
In reply to#1322134
On 01/30/2016 12:31 AM, Alexey Khoroshilov wrote:
> It seems clk_disable_unprepare() is missed in dw_i2c_plat_remove(),
> so the patch adds it.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
>   drivers/i2c/busses/i2c-designware-platdrv.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 438f1b4964c0..8f19b7b81fe0 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -267,6 +267,7 @@ static int dw_i2c_plat_remove(struct platform_device *pdev)
>   	i2c_del_adapter(&dev->adapter);
>
>   	i2c_dw_disable(dev);
> +	i2c_dw_plat_prepare_clk(dev, false);
>
I tried this quickly and it appears more work is needed. When 
CONFIG_PM_SLEEP is set then autosuspending will do the unprepare and 
this patch causes double unprepare at remove. But when CONFIG_PM_SLEEP 
is not set then indeed those clk calls are out of sync.

-- 
Jarkko

[toc] | [prev] | [next] | [standalone]


#1323193

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2016-02-01 15:50 +0100
Message-ID<qXnXL-4fD-111@gated-at.bofh.it>
In reply to#1323170
On Mon, 2016-02-01 at 16:21 +0200, Jarkko Nikula wrote:
> On 01/30/2016 12:31 AM, Alexey Khoroshilov wrote:
> > It seems clk_disable_unprepare() is missed in dw_i2c_plat_remove(),
> > so the patch adds it.
> > 
> > Found by Linux Driver Verification project (linuxtesting.org).
> > 
> > Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> > ---
> >   drivers/i2c/busses/i2c-designware-platdrv.c | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c
> > b/drivers/i2c/busses/i2c-designware-platdrv.c
> > index 438f1b4964c0..8f19b7b81fe0 100644
> > --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> > +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> > @@ -267,6 +267,7 @@ static int dw_i2c_plat_remove(struct
> > platform_device *pdev)
> >   	i2c_del_adapter(&dev->adapter);
> > 
> >   	i2c_dw_disable(dev);
> > +	i2c_dw_plat_prepare_clk(dev, false);
> > 
> I tried this quickly and it appears more work is needed. When 
> CONFIG_PM_SLEEP is set then autosuspending will do the unprepare and 
> this patch causes double unprepare at remove. But when
> CONFIG_PM_SLEEP 
> is not set then indeed those clk calls are out of sync.

Besides that I would suggest to check carefully error patch in the
probe(), i.e. handling error from i2c_dw_probe(). There maybe similar
issue is hidden.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web