Commit 6f7d8d35 authored by David S. Miller's avatar David S. Miller

[SPARC64]: Fix wakeup races in power.c, with help from Andrew Morton.

parent 586a9edd
...@@ -29,8 +29,8 @@ static int button_pressed; ...@@ -29,8 +29,8 @@ static int button_pressed;
static irqreturn_t power_handler(int irq, void *dev_id, struct pt_regs *regs) static irqreturn_t power_handler(int irq, void *dev_id, struct pt_regs *regs)
{ {
if (button_pressed == 0) { if (button_pressed == 0) {
wake_up(&powerd_wait);
button_pressed = 1; button_pressed = 1;
wake_up(&powerd_wait);
} }
/* FIXME: Check registers for status... */ /* FIXME: Check registers for status... */
...@@ -86,10 +86,10 @@ static int powerd(void *__unused) ...@@ -86,10 +86,10 @@ static int powerd(void *__unused)
remove_wait_queue(&powerd_wait, &wait); remove_wait_queue(&powerd_wait, &wait);
/* Ok, down we go... */ /* Ok, down we go... */
button_pressed = 0;
if (execve("/sbin/shutdown", argv, envp) < 0) { if (execve("/sbin/shutdown", argv, envp) < 0) {
printk("powerd: shutdown execution failed\n"); printk("powerd: shutdown execution failed\n");
add_wait_queue(&powerd_wait, &wait); add_wait_queue(&powerd_wait, &wait);
button_pressed = 0;
goto again; goto again;
} }
return 0; return 0;
......
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