diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-05-06 17:50:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:12:59 -0400 |
commit | f0ced9b229cfbc76b5db9837b4b256b602d56610 (patch) | |
tree | 1c9cb6b6c73579aa103ff266f1f35e6d47da223e /kernel/power | |
parent | ab3bfca7abf3fd0fe41d26d839610a787aa7e587 (diff) |
power management: change /sys/power/disk display
Change /sys/power/disk to display all valid modes as well as the currently
selected one in a fashion known from the LED subsystem.
This changes userspace API, but it is apparently not used much (we asked
some userspace developers)
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
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/disk.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index e518379b667a..06331374d862 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -350,7 +350,34 @@ static const char * const pm_disk_modes[] = { | |||
350 | 350 | ||
351 | static ssize_t disk_show(struct kset *kset, char *buf) | 351 | static ssize_t disk_show(struct kset *kset, char *buf) |
352 | { | 352 | { |
353 | return sprintf(buf, "%s\n", pm_disk_modes[pm_disk_mode]); | 353 | int i; |
354 | char *start = buf; | ||
355 | |||
356 | for (i = PM_DISK_PLATFORM; i < PM_DISK_MAX; i++) { | ||
357 | if (!pm_disk_modes[i]) | ||
358 | continue; | ||
359 | switch (i) { | ||
360 | case PM_DISK_SHUTDOWN: | ||
361 | case PM_DISK_REBOOT: | ||
362 | case PM_DISK_TEST: | ||
363 | case PM_DISK_TESTPROC: | ||
364 | break; | ||
365 | default: | ||
366 | if (pm_ops && pm_ops->enter && | ||
367 | (i == pm_ops->pm_disk_mode)) | ||
368 | break; | ||
369 | /* not a valid mode, continue with loop */ | ||
370 | continue; | ||
371 | } | ||
372 | if (i == pm_disk_mode) | ||
373 | buf += sprintf(buf, "[%s]", pm_disk_modes[i]); | ||
374 | else | ||
375 | buf += sprintf(buf, "%s", pm_disk_modes[i]); | ||
376 | if (i+1 != PM_DISK_MAX) | ||
377 | buf += sprintf(buf, " "); | ||
378 | } | ||
379 | buf += sprintf(buf, "\n"); | ||
380 | return buf-start; | ||
354 | } | 381 | } |
355 | 382 | ||
356 | 383 | ||