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

From: Wolfram Sang
Date: Fri Feb 12 2016 - 13:54:15 EST


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@xxxxxxxxx>
> > > ---
> > > Â 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: signature.asc
Description: Digital signature