mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
i2c: Fix checks which cause legacy suspend to never get called
For devices which are not adapted to runtime PM a call to pm_runtime_suspended always returns true. Hence the pm_runtime_suspended checks below prevent legacy suspend from getting called. So do a pm_runtime_suspended check only for devices with a dev_pm_ops populated (which hence do not rely on the legacy suspend.) Signed-off-by: Rajendra Nayak <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Cc: Ben Dooks <[email protected]> Cc: Mark Brown <[email protected]> Cc: Kevin Hilman <[email protected]> Signed-off-by: Jean Delvare <[email protected]>
This commit is contained in:
parent
6abb930af0
commit
64b4782fc9
1 changed files with 24 additions and 20 deletions
|
|
@ -197,11 +197,12 @@ static int i2c_device_pm_suspend(struct device *dev)
|
|||
{
|
||||
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
|
||||
|
||||
if (pm_runtime_suspended(dev))
|
||||
return 0;
|
||||
|
||||
if (pm)
|
||||
return pm->suspend ? pm->suspend(dev) : 0;
|
||||
if (pm) {
|
||||
if (pm_runtime_suspended(dev))
|
||||
return 0;
|
||||
else
|
||||
return pm->suspend ? pm->suspend(dev) : 0;
|
||||
}
|
||||
|
||||
return i2c_legacy_suspend(dev, PMSG_SUSPEND);
|
||||
}
|
||||
|
|
@ -223,11 +224,12 @@ static int i2c_device_pm_freeze(struct device *dev)
|
|||
{
|
||||
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
|
||||
|
||||
if (pm_runtime_suspended(dev))
|
||||
return 0;
|
||||
|
||||
if (pm)
|
||||
return pm->freeze ? pm->freeze(dev) : 0;
|
||||
if (pm) {
|
||||
if (pm_runtime_suspended(dev))
|
||||
return 0;
|
||||
else
|
||||
return pm->freeze ? pm->freeze(dev) : 0;
|
||||
}
|
||||
|
||||
return i2c_legacy_suspend(dev, PMSG_FREEZE);
|
||||
}
|
||||
|
|
@ -236,11 +238,12 @@ static int i2c_device_pm_thaw(struct device *dev)
|
|||
{
|
||||
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
|
||||
|
||||
if (pm_runtime_suspended(dev))
|
||||
return 0;
|
||||
|
||||
if (pm)
|
||||
return pm->thaw ? pm->thaw(dev) : 0;
|
||||
if (pm) {
|
||||
if (pm_runtime_suspended(dev))
|
||||
return 0;
|
||||
else
|
||||
return pm->thaw ? pm->thaw(dev) : 0;
|
||||
}
|
||||
|
||||
return i2c_legacy_resume(dev);
|
||||
}
|
||||
|
|
@ -249,11 +252,12 @@ static int i2c_device_pm_poweroff(struct device *dev)
|
|||
{
|
||||
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
|
||||
|
||||
if (pm_runtime_suspended(dev))
|
||||
return 0;
|
||||
|
||||
if (pm)
|
||||
return pm->poweroff ? pm->poweroff(dev) : 0;
|
||||
if (pm) {
|
||||
if (pm_runtime_suspended(dev))
|
||||
return 0;
|
||||
else
|
||||
return pm->poweroff ? pm->poweroff(dev) : 0;
|
||||
}
|
||||
|
||||
return i2c_legacy_suspend(dev, PMSG_HIBERNATE);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue