Re: [PATCH v4 1/3] PM: i2c-designware-platdrv: Clean up PM handling in probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday, September 25, 2017 9:12:28 PM CEST Ulf Hansson wrote:
> On 25 September 2017 at 01:17, Rafael J. Wysocki <rjw@xxxxxxxxxxxxx> wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> >
> > The power management handling in dw_i2c_plat_probe() is somewhat
> > messy and it is rather hard to figure out the code intention for
> > the case when pm_disabled is set.  In that case, the driver doesn't
> > enable runtime PM at all, but in addition to that it calls
> > pm_runtime_forbid() as though it wasn't sure if runtime PM might
> > be enabled for the device later by someone else.
> >
> > Although that concern doesn't seem to be actually valid, the
> > device is clearly still expected to be PM-capable even in the
> > pm_disabled set case, so a better approach would be to enable
> > runtime PM for it unconditionally and then prevent it from
> > being runtime-suspended by using pm_runtime_forbid().
> 
> This is nice cleanup! However I have one suggestion/comment.
> 
> Using pm_runtime_forbid() to prevent the device from being runtime
> suspended may be a bit fragile, as userspace can then still change to
> "allow" it. Wouldn't it be better to bump the runtime PM usage count
> (pm_runtime_get_noresume()) instead?

Right, this is not a PCI driver. :-)

I'll send an update of this patch shortly.

Thanks,
Rafael






[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux