diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-04-30 18:09:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-04-30 19:40:40 -0400 |
commit | e8c9c502690efd24b7055bf608e7a3c34216848b (patch) | |
tree | 1583f34ec9cac07ddfdcb24de66e49718b107436 /kernel/power | |
parent | 11d77d0c01b80e44c7aceb21928508dafce774f9 (diff) |
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 <johannes@sipsolutions.net>
Cc: David Brownell <david-b@pacbell.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: linux-pm@lists.linux-foundation.org
Cc: Len Brown <lenb@kernel.org>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Greg KH <greg@kroah.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/main.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index 053c0a7d7f57..f94f4e20115a 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -48,6 +48,19 @@ void pm_set_ops(struct pm_ops * ops) | |||
48 | mutex_unlock(&pm_mutex); | 48 | mutex_unlock(&pm_mutex); |
49 | } | 49 | } |
50 | 50 | ||
51 | /** | ||
52 | * pm_valid_only_mem - generic memory-only valid callback | ||
53 | * | ||
54 | * pm_ops drivers that implement mem suspend only and only need | ||
55 | * to check for that in their .valid callback can use this instead | ||
56 | * of rolling their own .valid callback. | ||
57 | */ | ||
58 | int pm_valid_only_mem(suspend_state_t state) | ||
59 | { | ||
60 | return state == PM_SUSPEND_MEM; | ||
61 | } | ||
62 | |||
63 | |||
51 | static inline void pm_finish(suspend_state_t state) | 64 | static inline void pm_finish(suspend_state_t state) |
52 | { | 65 | { |
53 | if (pm_ops->finish) | 66 | if (pm_ops->finish) |