All of lore.kernel.org
 help / color / mirror / Atom feed
* i2c imx: suspicious use of runtime PM calls
@ 2015-08-22 21:42 Heiner Kallweit
       [not found] ` <55D8ECBA.6050505-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2015-08-22 21:42 UTC (permalink / raw)
  To: Gao Pan; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Wolfram Sang

Just by chance I stumbled across this driver and the recently added runtime PM code.
Two things in i2c_imx_probe look suspicious to me:

- You activate the I2C clock and then initialize runtime PM with

    pm_runtime_enable(&pdev->dev);
    pm_runtime_set_autosuspend_delay(&pdev->dev, I2C_PM_TIMEOUT);
    pm_runtime_use_autosuspend(&pdev->dev);

  Seems like a call to pm_runtime_set_active is missing to tell runtime PM
  that the device is in status "active" now.

- You use pm_runtime_put_autosuspend (which decrements the ref count) but you don't
  get a reference before. I think you would have to use pm_runtime_get_... before
  or use pm_runtime_autosuspend.

Regards, Heiner

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: i2c imx: suspicious use of runtime PM calls
       [not found] ` <55D8ECBA.6050505-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-08-24  5:08   ` Gao Pandy
       [not found]     ` <CY1PR0301MB0858E9E871CC1D399F45B1B3CF620-YrwGdl+PljlUWoKpOwApjpwN6zqB+hSMnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Gao Pandy @ 2015-08-24  5:08 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Wolfram Sang, Gao Pandy

From: Heiner Kallweit <mailto:hkallweit1@gmail.com> Sent: Sunday, August 23, 2015 5:42 AM
> To: Gao Pan-B54642
> Cc: linux-i2c@vger.kernel.org; Wolfram Sang
> Subject: i2c imx: suspicious use of runtime PM calls
> 
> Just by chance I stumbled across this driver and the recently added
> runtime PM code.
> Two things in i2c_imx_probe look suspicious to me:
> 
> - You activate the I2C clock and then initialize runtime PM with
> 
>     pm_runtime_enable(&pdev->dev);
>     pm_runtime_set_autosuspend_delay(&pdev->dev, I2C_PM_TIMEOUT);
>     pm_runtime_use_autosuspend(&pdev->dev);
> 
>   Seems like a call to pm_runtime_set_active is missing to tell runtime
> PM that the device is in status "active" now.
 
Thanks, you are right. I will fix it in next patch.

> - You use pm_runtime_put_autosuspend (which decrements the ref count) but
> you don't
>   get a reference before. I think you would have to use pm_runtime_get_...
> before or use pm_runtime_autosuspend.

Thanks for your precise review. I will fix it in next patch.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: i2c imx: suspicious use of runtime PM calls
       [not found]     ` <CY1PR0301MB0858E9E871CC1D399F45B1B3CF620-YrwGdl+PljlUWoKpOwApjpwN6zqB+hSMnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
@ 2015-08-24 12:09       ` Wolfram Sang
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2015-08-24 12:09 UTC (permalink / raw)
  To: Gao Pandy; +Cc: Heiner Kallweit, linux-i2c-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]


> > Just by chance I stumbled across this driver and the recently added
> > runtime PM code.
> > Two things in i2c_imx_probe look suspicious to me:
> > 
> > - You activate the I2C clock and then initialize runtime PM with
> > 
> >     pm_runtime_enable(&pdev->dev);
> >     pm_runtime_set_autosuspend_delay(&pdev->dev, I2C_PM_TIMEOUT);
> >     pm_runtime_use_autosuspend(&pdev->dev);
> > 
> >   Seems like a call to pm_runtime_set_active is missing to tell runtime
> > PM that the device is in status "active" now.
>  
> Thanks, you are right. I will fix it in next patch.

Thanks Heiner for the report. I dropped this patch and will wait for a
new version.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-24 12:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-22 21:42 i2c imx: suspicious use of runtime PM calls Heiner Kallweit
     [not found] ` <55D8ECBA.6050505-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-08-24  5:08   ` Gao Pandy
     [not found]     ` <CY1PR0301MB0858E9E871CC1D399F45B1B3CF620-YrwGdl+PljlUWoKpOwApjpwN6zqB+hSMnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2015-08-24 12:09       ` Wolfram Sang

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.