patch-2.4.23 linux-2.4.23/drivers/acpi/system.c

Next file: linux-2.4.23/drivers/acpi/tables/tbconvrt.c
Previous file: linux-2.4.23/drivers/acpi/resources/rsirq.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.22/drivers/acpi/system.c linux-2.4.23/drivers/acpi/system.c
@@ -31,6 +31,7 @@
 #include <linux/spinlock.h>
 #include <linux/poll.h>
 #include <linux/delay.h>
+#include <linux/interrupt.h>
 #include <linux/sysrq.h>
 #include <linux/compatmac.h>
 #include <linux/proc_fs.h>
@@ -92,7 +93,13 @@
 static void
 acpi_power_off (void)
 {
-	acpi_suspend(ACPI_STATE_S5);
+	if (unlikely(in_interrupt())) 
+		BUG();
+	acpi_enter_sleep_state_prep(ACPI_STATE_S5);
+	ACPI_DISABLE_IRQS();
+	acpi_enter_sleep_state(ACPI_STATE_S5);
+
+	printk(KERN_EMERG "ACPI: can not power off machine\n");
 }
 
 #endif /*CONFIG_PM*/
@@ -1192,11 +1199,21 @@
 
 #if defined(CONFIG_MAGIC_SYSRQ) && defined(CONFIG_PM)
 
+static int po_cb_active; 
+
+static void acpi_po_tramp(void *x)
+{ 
+	acpi_power_off();	
+} 
+
 /* Simple wrapper calling power down function. */
 static void acpi_sysrq_power_off(int key, struct pt_regs *pt_regs,
 	struct kbd_struct *kbd, struct tty_struct *tty)
-{
-	acpi_power_off();
+{	
+	static struct tq_struct tq = { .routine = acpi_po_tramp };
+	if (po_cb_active++)
+		return;
+	schedule_task(&tq); 
 }
 
 struct sysrq_key_op sysrq_acpi_poweroff_op = {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)