Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 11787
b: refs/heads/master
c: eb9289e
h: refs/heads/master
i:
  11785: 1abb999
  11783: b50b57a
v: v3
  • Loading branch information
Shaohua Li authored and Linus Torvalds committed Oct 31, 2005
1 parent cadcafa commit b449d3b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 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: 0245b3e787dc3267a915e1f56419e7e9c197e148
refs/heads/master: eb9289eb20df6b54214c45ac7c6bf5179a149026
8 changes: 8 additions & 0 deletions trunk/drivers/acpi/sleep/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,15 @@ int acpi_suspend(u32 acpi_state)
return -EINVAL;
}

static int acpi_pm_state_valid(suspend_state_t pm_state)
{
u32 acpi_state = acpi_suspend_states[pm_state];

return sleep_states[acpi_state];
}

static struct pm_ops acpi_pm_ops = {
.valid = acpi_pm_state_valid,
.prepare = acpi_pm_prepare,
.enter = acpi_pm_enter,
.finish = acpi_pm_finish,
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/pm.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ typedef int __bitwise suspend_disk_method_t;

struct pm_ops {
suspend_disk_method_t pm_disk_mode;
int (*valid)(suspend_state_t state);
int (*prepare)(suspend_state_t state);
int (*enter)(suspend_state_t state);
int (*finish)(suspend_state_t state);
Expand Down
5 changes: 4 additions & 1 deletion trunk/kernel/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ static int enter_state(suspend_state_t state)
{
int error;

if (pm_ops->valid && !pm_ops->valid(state))
return -ENODEV;
if (down_trylock(&pm_sem))
return -EBUSY;

Expand Down Expand Up @@ -236,7 +238,8 @@ static ssize_t state_show(struct subsystem * subsys, char * buf)
char * s = buf;

for (i = 0; i < PM_SUSPEND_MAX; i++) {
if (pm_states[i])
if (pm_states[i] && pm_ops && (!pm_ops->valid
||(pm_ops->valid && pm_ops->valid(i))))
s += sprintf(s,"%s ",pm_states[i]);
}
s += sprintf(s,"\n");
Expand Down

0 comments on commit b449d3b

Please sign in to comment.