Re: [PATCH] i2c: designware: Prevent runtime suspend during adapter registration

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

 



On Thu, Feb 11, 2016 at 04:36:03PM +0200, Jarkko Nikula wrote:
> There can be unnecessary runtime suspend-resume cycle during
> i2c-designware-platdrv probe when it registers the I2C adapter device. This
> happens because i2c-designware-platdrv is set to initially active platform
> device in its probe function and is a parent of I2C adapter.
> 
> In that case power.usage_count of i2c-designware device is zero and
> pm_runtime_get()/pm_runtime_put() cycle during probe could put it into
> runtime suspend. This happens when the i2c_register_adapter() calls the
> device_register():
> 
> i2c_register_adapter
>   device_register
>     device_add
>       bus_probe_device
>         device_initial_probe
>           __device_attach
>             if (dev->parent) pm_runtime_get_sync(dev->parent)
>             ...
>             if (dev->parent) pm_runtime_put(dev->parent)
> 
> After that the i2c_register_adapter() continues registering I2C slave
> devices. In case slave device probe does I2C transfers the parent will
> resume again and thus get a needless runtime suspend/resume cycle during
> adapter registration.
> 
> Prevent this while retaining the runtime PM status of i2c-designware by
> only incrementing/decrementing device power usage count during I2C
> adapter registration. That makes sure there won't be spurious runtime PM
> status changes and lets the driver core to idle the device after probe
> finishes.
> 
> Signed-off-by: Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx>

Applied to for-next, thanks!

Attachment: signature.asc
Description: Digital signature


[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