diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-02-16 04:38:29 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-23 17:52:09 -0500 |
commit | 9c372d06ce9ddf65e1393f9ea22a6d6bd5f96b42 (patch) | |
tree | 24e4b7d7ab60d68426c6c3e2ba976deffb94e575 /kernel/power | |
parent | dfe461aef0d621d8472d0af343ae8a60866a7a8a (diff) |
power management: no valid states w/o pm_ops
Change /sys/power/state to not advertise any valid states (except for disk
if SOFTWARE_SUSPEND is enabled) when no pm_ops have been set so userspace
can easily discover what states should be available.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Pavel Macheck <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index e1c413120469..a064dfd8877a 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -167,7 +167,10 @@ static inline int valid_state(suspend_state_t state) | |||
167 | if (state == PM_SUSPEND_DISK) | 167 | if (state == PM_SUSPEND_DISK) |
168 | return 1; | 168 | return 1; |
169 | 169 | ||
170 | if (pm_ops && pm_ops->valid && !pm_ops->valid(state)) | 170 | /* all other states need lowlevel support and need to be |
171 | * valid to the lowlevel implementation, no valid callback | ||
172 | * implies that all are valid. */ | ||
173 | if (!pm_ops || (pm_ops->valid && !pm_ops->valid(state))) | ||
171 | return 0; | 174 | return 0; |
172 | return 1; | 175 | return 1; |
173 | } | 176 | } |