Skip to content

Commit

Permalink
PM / Runtime: Fix pm_runtime_suspended()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Rafael J. Wysocki committed Dec 16, 2010
1 parent be8cd64 commit f08f5a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Documentation/power/runtime_pm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,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
Expand Down
3 changes: 2 additions & 1 deletion include/linux/pm_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,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;
}

static inline void pm_runtime_mark_last_busy(struct device *dev)
Expand Down

0 comments on commit f08f5a0

Please sign in to comment.