]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
PM / Runtime: Generic resume shouldn't set RPM_ACTIVE unconditionally
authorRafael J. Wysocki <rjw@sisk.pl>
Fri, 24 Dec 2010 14:04:06 +0000 (15:04 +0100)
committerRafael J. Wysocki <rjw@sisk.pl>
Fri, 24 Dec 2010 14:04:06 +0000 (15:04 +0100)
The __pm_generic_resume() function changes the given device's runtime
PM status to RPM_ACTIVE if its driver's callback returns 0, but it
only should do that if the rumtime PM is enabled for the device.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
drivers/base/power/generic_ops.c
include/linux/pm_runtime.h

index 3d2c3500069a912d63f051d1fc9fe8dc332d42f0..42f97f925629b7422080e2453a1d02b24d033f5b 100644 (file)
@@ -185,7 +185,7 @@ static int __pm_generic_resume(struct device *dev, int event)
                return 0;
 
        ret = callback(dev);
-       if (!ret) {
+       if (!ret && pm_runtime_enabled(dev)) {
                pm_runtime_disable(dev);
                pm_runtime_set_active(dev);
                pm_runtime_enable(dev);
index e9cc049ccb624e144e8ecff8c9b86161eaded442..d34f067e2a7f31e5b391b22382b811913b407515 100644 (file)
@@ -82,6 +82,11 @@ static inline bool pm_runtime_suspended(struct device *dev)
                && !dev->power.disable_depth;
 }
 
+static inline bool pm_runtime_enabled(struct device *dev)
+{
+       return !dev->power.disable_depth;
+}
+
 static inline void pm_runtime_mark_last_busy(struct device *dev)
 {
        ACCESS_ONCE(dev->power.last_busy) = jiffies;
@@ -120,6 +125,7 @@ static inline void pm_runtime_put_noidle(struct device *dev) {}
 static inline bool device_run_wake(struct device *dev) { return false; }
 static inline void device_set_run_wake(struct device *dev, bool enable) {}
 static inline bool pm_runtime_suspended(struct device *dev) { return false; }
+static inline bool pm_runtime_enabled(struct device *dev) { return false; }
 
 static inline int pm_generic_runtime_idle(struct device *dev) { return 0; }
 static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }