* [PATCH] i2c: designware: balance clk enable/disable on removal
@ 2016-01-29 22:31 Alexey Khoroshilov
2016-02-01 14:21 ` Jarkko Nikula
0 siblings, 1 reply; 5+ messages in thread
From: Alexey Khoroshilov @ 2016-01-29 22:31 UTC (permalink / raw)
To: Andy Shevchenko, Jarkko Nikula, Mika Westerberg
Cc: Wolfram Sang, linux-i2c, linux-kernel, ldv-project, Alexey Khoroshilov
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: designware: balance clk enable/disable on removal
2016-01-29 22:31 [PATCH] i2c: designware: balance clk enable/disable on removal Alexey Khoroshilov
@ 2016-02-01 14:21 ` Jarkko Nikula
2016-02-01 14:44 ` Andy Shevchenko
0 siblings, 1 reply; 5+ messages in thread
From: Jarkko Nikula @ 2016-02-01 14:21 UTC (permalink / raw)
To: Alexey Khoroshilov, Andy Shevchenko, Mika Westerberg
Cc: Wolfram Sang, linux-i2c, linux-kernel, ldv-project
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: designware: balance clk enable/disable on removal
2016-02-01 14:21 ` Jarkko Nikula
@ 2016-02-01 14:44 ` Andy Shevchenko
2016-02-12 18:54 ` Wolfram Sang
0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2016-02-01 14:44 UTC (permalink / raw)
To: Jarkko Nikula, Alexey Khoroshilov, Mika Westerberg
Cc: Wolfram Sang, linux-i2c, linux-kernel, ldv-project
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: designware: balance clk enable/disable on removal
2016-02-01 14:44 ` Andy Shevchenko
@ 2016-02-12 18:54 ` Wolfram Sang
2016-02-13 22:16 ` Alexey Khoroshilov
0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2016-02-12 18:54 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jarkko Nikula, Alexey Khoroshilov, Mika Westerberg, linux-i2c,
linux-kernel, ldv-project
[-- Attachment #1: Type: text/plain, Size: 1559 bytes --]
On Mon, Feb 01, 2016 at 04:44:05PM +0200, Andy Shevchenko wrote:
> 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.
So, waiting for V2 on this one.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: designware: balance clk enable/disable on removal
2016-02-12 18:54 ` Wolfram Sang
@ 2016-02-13 22:16 ` Alexey Khoroshilov
0 siblings, 0 replies; 5+ messages in thread
From: Alexey Khoroshilov @ 2016-02-13 22:16 UTC (permalink / raw)
To: Wolfram Sang, Andy Shevchenko
Cc: Jarkko Nikula, Mika Westerberg, linux-i2c, linux-kernel, ldv-project
On 12.02.2016 21:54, Wolfram Sang wrote:
> On Mon, Feb 01, 2016 at 04:44:05PM +0200, Andy Shevchenko wrote:
>> 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.
>
> So, waiting for V2 on this one.
>
I have a fix for error handling of i2c_dw_probe(), but I am not sure
what is the right approach to handle CONFIG_PM_SLEEP case.
What is a safe way to distinguish a need for the unprepare in
dw_i2c_plat_remove()?
Should we try to avoid double i2c_dw_disable(dev) in the same case?
--
Alexey
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-02-13 22:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-29 22:31 [PATCH] i2c: designware: balance clk enable/disable on removal Alexey Khoroshilov
2016-02-01 14:21 ` Jarkko Nikula
2016-02-01 14:44 ` Andy Shevchenko
2016-02-12 18:54 ` Wolfram Sang
2016-02-13 22:16 ` Alexey Khoroshilov
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.