mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
power management: implement pm_ops.valid for everybody
Almost all users of pm_ops only support mem sleep, don't check in .valid and don't reject any others in .prepare so users can be confused if they check /sys/power/state, especially when new states are added (these would then result in s-t-r although they're supposed to be something different). This patch implements a generic pm_valid_only_mem function that is then exported for users and puts it to use in almost all existing pm_ops. Signed-off-by: Johannes Berg <[email protected]> Cc: David Brownell <[email protected]> Acked-by: Pavel Machek <[email protected]> Cc: [email protected] Cc: Len Brown <[email protected]> Acked-by: Russell King <[email protected]> Cc: Greg KH <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Paul Mundt <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
11d77d0c01
commit
e8c9c50269
11 changed files with 39 additions and 55 deletions
|
|
@ -48,6 +48,19 @@ void pm_set_ops(struct pm_ops * ops)
|
|||
mutex_unlock(&pm_mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_valid_only_mem - generic memory-only valid callback
|
||||
*
|
||||
* pm_ops drivers that implement mem suspend only and only need
|
||||
* to check for that in their .valid callback can use this instead
|
||||
* of rolling their own .valid callback.
|
||||
*/
|
||||
int pm_valid_only_mem(suspend_state_t state)
|
||||
{
|
||||
return state == PM_SUSPEND_MEM;
|
||||
}
|
||||
|
||||
|
||||
static inline void pm_finish(suspend_state_t state)
|
||||
{
|
||||
if (pm_ops->finish)
|
||||
|
|
|
|||
Loading…
Reference in a new issue