diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-05-10 17:23:06 +0800 |
---|---|---|
committer | Sammy He <r62914@freescale.com> | 2011-05-10 17:24:59 +0800 |
commit | 9928295370806518fa7dd2e653624b1ee007905e (patch) | |
tree | c19ac8f9d8a0ca0a29e64d5ac0885226dd7eef8d | |
parent | 53e03306742288842705ee0ddc93a0e0022cfaaa (diff) |
PM / Runtime: Fix pm_runtime_suspended()
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>
Cc: stable@kernel.org
-rw-r--r-- | Documentation/power/runtime_pm.txt | 4 | ||||
-rw-r--r-- | include/linux/pm_runtime.h | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 55b859b3bc72..506d9d916e41 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt @@ -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 diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 6e81888c6222..834dfcfb520a 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -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 */ |