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


Groups > linux.kernel > #1333039 > unrolled thread

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

Started byWolfram Sang <wsa@the-dreams.de>
First post2016-02-12 20:00 +0100
Last post2016-02-13 23:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] i2c: designware: balance clk enable/disable on removal Wolfram Sang <wsa@the-dreams.de> - 2016-02-12 20:00 +0100
    Re: [PATCH] i2c: designware: balance clk enable/disable on removal Alexey Khoroshilov <khoroshilov@ispras.ru> - 2016-02-13 23:20 +0100

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

FromWolfram Sang <wsa@the-dreams.de>
Date2016-02-12 20:00 +0100
SubjectRe: [PATCH] i2c: designware: balance clk enable/disable on removal
Message-ID<r1r6G-2oL-19@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

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.

[toc] | [next] | [standalone]


#1333373

FromAlexey Khoroshilov <khoroshilov@ispras.ru>
Date2016-02-13 23:20 +0100
Message-ID<r1QHL-2mm-1@gated-at.bofh.it>
In reply to#1333039
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web