Commit 9c2ea509 authored by Patrick Mochel's avatar Patrick Mochel

[power] Fix up sysfs state handling.

parent ab2672c6
...@@ -122,12 +122,9 @@ static int power_down(u32 mode) ...@@ -122,12 +122,9 @@ static int power_down(u32 mode)
switch(mode) { switch(mode) {
case PM_DISK_PLATFORM: case PM_DISK_PLATFORM:
error = pm_ops->enter(PM_SUSPEND_DISK); error = pm_ops->enter(PM_SUSPEND_DISK);
if (error) { break;
device_power_up();
local_irq_restore(flags);
return error;
}
case PM_DISK_SHUTDOWN: case PM_DISK_SHUTDOWN:
printk("Powering off system\n");
machine_power_off(); machine_power_off();
break; break;
case PM_DISK_REBOOT: case PM_DISK_REBOOT:
...@@ -135,6 +132,8 @@ static int power_down(u32 mode) ...@@ -135,6 +132,8 @@ static int power_down(u32 mode)
break; break;
} }
machine_halt(); machine_halt();
device_power_up();
local_irq_restore(flags);
return 0; return 0;
} }
...@@ -304,7 +303,7 @@ static int enter_state(u32 state) ...@@ -304,7 +303,7 @@ static int enter_state(u32 state)
goto Unlock; goto Unlock;
} }
pr_debug("PM: Preparing system for suspend.\n"); pr_debug("PM: Preparing system for suspend\n");
if ((error = suspend_prepare(state))) if ((error = suspend_prepare(state)))
goto Unlock; goto Unlock;
...@@ -493,16 +492,15 @@ static ssize_t state_show(struct subsystem * subsys, char * buf) ...@@ -493,16 +492,15 @@ static ssize_t state_show(struct subsystem * subsys, char * buf)
static ssize_t state_store(struct subsystem * subsys, const char * buf, size_t n) static ssize_t state_store(struct subsystem * subsys, const char * buf, size_t n)
{ {
u32 state; u32 state = PM_SUSPEND_STANDBY;
struct pm_state * s; struct pm_state * s;
int error; int error;
for (state = 0; state < PM_SUSPEND_MAX; state++) { for (s = &pm_states[state]; s->name; s++, state++) {
s = &pm_states[state]; if (!strcmp(buf,s->name))
if (s->name && !strcmp(buf,s->name))
break; break;
} }
if (s) if (s->name)
error = enter_state(state); error = enter_state(state);
else else
error = -EINVAL; error = -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment