Permalink
Browse files

i2c-core: fix runtime_pm issues

The i2c-core skips calling suspend if the device is runtime suspended.
This is an issue because all the devices that don't explicitly notify
the runtime pm system are assumed suspended.

This change is based on a patch from Mark Brown here.
http://www.spinics.net/lists/linux-i2c/msg04635.html

Change-Id: I12e10426b94bd2f4ce8ad8bef6e14ec39d0d412f
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
  • Loading branch information...
1 parent 8ffdb50 commit 013c98be53d0a3e9a51aa6191ed5a0ef50216101 Abhijeet Dharmapurikar committed with LeeDrOiD Jan 5, 2011
Showing with 8 additions and 30 deletions.
  1. +8 −30 drivers/i2c/i2c-core.c
View
@@ -191,12 +191,8 @@ static int i2c_device_pm_suspend(struct device *dev)
{
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
- if (pm) {
- if (pm_runtime_suspended(dev))
- return 0;
- else
- return pm->suspend ? pm->suspend(dev) : 0;
- }
+ if (pm)
+ return pm->suspend ? pm->suspend(dev) : 0;
return i2c_legacy_suspend(dev, PMSG_SUSPEND);
}
@@ -218,12 +214,8 @@ static int i2c_device_pm_freeze(struct device *dev)
{
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
- if (pm) {
- if (pm_runtime_suspended(dev))
- return 0;
- else
- return pm->freeze ? pm->freeze(dev) : 0;
- }
+ if (pm)
+ return pm->freeze ? pm->freeze(dev) : 0;
return i2c_legacy_suspend(dev, PMSG_FREEZE);
}
@@ -232,12 +224,8 @@ static int i2c_device_pm_thaw(struct device *dev)
{
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
- if (pm) {
- if (pm_runtime_suspended(dev))
- return 0;
- else
- return pm->thaw ? pm->thaw(dev) : 0;
- }
+ if (pm)
+ return pm->thaw ? pm->thaw(dev) : 0;
return i2c_legacy_resume(dev);
}
@@ -246,12 +234,8 @@ static int i2c_device_pm_poweroff(struct device *dev)
{
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
- if (pm) {
- if (pm_runtime_suspended(dev))
- return 0;
- else
- return pm->poweroff ? pm->poweroff(dev) : 0;
- }
+ if (pm)
+ return pm->poweroff ? pm->poweroff(dev) : 0;
return i2c_legacy_suspend(dev, PMSG_HIBERNATE);
}
@@ -266,12 +250,6 @@ static int i2c_device_pm_restore(struct device *dev)
else
ret = i2c_legacy_resume(dev);
- if (!ret) {
- pm_runtime_disable(dev);
- pm_runtime_set_active(dev);
- pm_runtime_enable(dev);
- }
-
return ret;
}
#else /* !CONFIG_PM_SLEEP */

0 comments on commit 013c98b

Please sign in to comment.