Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54270
b: refs/heads/master
c: f0ced9b
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and Linus Torvalds committed May 7, 2007
1 parent 52ae0c4 commit 7422bc1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ab3bfca7abf3fd0fe41d26d839610a787aa7e587
refs/heads/master: f0ced9b229cfbc76b5db9837b4b256b602d56610
8 changes: 6 additions & 2 deletions trunk/Documentation/power/interface.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ for 5 seconds, resume devices, unfreeze tasks and enable nonboot CPUs. Then,
we are able to look in the log messages and work out, for example, which code
is being slow and which device drivers are misbehaving.

Reading from this file will display what the mode is currently set
to. Writing to this file will accept one of
Reading from this file will display all supported modes and the currently
selected one in brackets, for example

[shutdown] reboot test testproc

Writing to this file will accept one of

'platform' (only if the platform supports it)
'shutdown'
Expand Down
29 changes: 28 additions & 1 deletion trunk/kernel/power/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,34 @@ static const char * const pm_disk_modes[] = {

static ssize_t disk_show(struct kset *kset, char *buf)
{
return sprintf(buf, "%s\n", pm_disk_modes[pm_disk_mode]);
int i;
char *start = buf;

for (i = PM_DISK_PLATFORM; i < PM_DISK_MAX; i++) {
if (!pm_disk_modes[i])
continue;
switch (i) {
case PM_DISK_SHUTDOWN:
case PM_DISK_REBOOT:
case PM_DISK_TEST:
case PM_DISK_TESTPROC:
break;
default:
if (pm_ops && pm_ops->enter &&
(i == pm_ops->pm_disk_mode))
break;
/* not a valid mode, continue with loop */
continue;
}
if (i == pm_disk_mode)
buf += sprintf(buf, "[%s]", pm_disk_modes[i]);
else
buf += sprintf(buf, "%s", pm_disk_modes[i]);
if (i+1 != PM_DISK_MAX)
buf += sprintf(buf, " ");
}
buf += sprintf(buf, "\n");
return buf-start;
}


Expand Down

0 comments on commit 7422bc1

Please sign in to comment.