]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
PM / Runtime: Fix pm_runtime_suspended()
authorRafael J. Wysocki <rjw@sisk.pl>
Thu, 16 Dec 2010 16:11:58 +0000 (17:11 +0100)
committerAK <andi@firstfloor.org>
Sun, 6 Feb 2011 19:03:41 +0000 (11:03 -0800)
commit f08f5a0add20834d3f3d876dfe08005a5df656db upstream.

There are some situations (e.g. in __pm_generic_call()), where
pm_runtime_suspended() is used to decide whether or not to execute
a device's (system) ->suspend() callback.  The callback is not
executed if pm_runtime_suspended() returns true, but it does so
for devices that don't even support runtime PM, because the
power.disable_depth device field is ignored by it.  This leads to
problems (i.e. devices are not suspened when they should), so rework
pm_runtime_suspended() so that it returns false if the device's
power.disable_depth field is different from zero.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Documentation/power/runtime_pm.txt
include/linux/pm_runtime.h

index 55b859b3bc723267db79d1b274bf820c37c7469a..506d9d916e4154c18ed8f4e37a167ca1d7b8105e 100644 (file)
@@ -336,8 +336,8 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
       zero)
 
   bool pm_runtime_suspended(struct device *dev);
-    - return true if the device's runtime PM status is 'suspended', or false
-      otherwise
+    - return true if the device's runtime PM status is 'suspended' and its
+      'power.disable_depth' field is equal to zero, or false otherwise
 
   void pm_runtime_allow(struct device *dev);
     - set the power.runtime_auto flag for the device and decrease its usage
index 6e81888c62225f99217ab356dd0f3c46a3a45715..5ea4b1582b07ed5e2c156f8fccec6849ab4475dd 100644 (file)
@@ -67,7 +67,8 @@ static inline void device_set_run_wake(struct device *dev, bool enable)
 
 static inline bool pm_runtime_suspended(struct device *dev)
 {
-       return dev->power.runtime_status == RPM_SUSPENDED;
+       return dev->power.runtime_status == RPM_SUSPENDED
+               && !dev->power.disable_depth;
 }
 
 #else /* !CONFIG_PM_RUNTIME */