Merge branch 'master' into upstream
[pandora-kernel.git] / drivers / acpi / sleep / poweroff.c
index a5f947d..d9801ef 100644 (file)
@@ -12,7 +12,6 @@
 #include <linux/pm.h>
 #include <linux/init.h>
 #include <acpi/acpi_bus.h>
-#include <linux/sched.h>
 #include <linux/sysdev.h>
 #include <asm/io.h>
 #include "sleep.h"
@@ -21,9 +20,7 @@ int acpi_sleep_prepare(u32 acpi_state)
 {
 #ifdef CONFIG_ACPI_SLEEP
        /* do we have a wakeup address for S2 and S3? */
-       /* Here, we support only S4BIOS, those we set the wakeup address */
-       /* S4OS is only supported for now via swsusp.. */
-       if (acpi_state == ACPI_STATE_S3 || acpi_state == ACPI_STATE_S4) {
+       if (acpi_state == ACPI_STATE_S3) {
                if (!acpi_wakeup_address) {
                        return -EFAULT;
                }
@@ -35,9 +32,7 @@ int acpi_sleep_prepare(u32 acpi_state)
        ACPI_FLUSH_CPU_CACHE();
        acpi_enable_wakeup_device_prep(acpi_state);
 #endif
-       if (acpi_state == ACPI_STATE_S5) {
-               acpi_wakeup_gpe_poweroff_prepare();
-       }
+       acpi_gpe_sleep_prepare(acpi_state);
        acpi_enter_sleep_state_prep(acpi_state);
        return 0;
 }
@@ -55,11 +50,16 @@ void acpi_power_off(void)
 
 static int acpi_shutdown(struct sys_device *x)
 {
-       if (system_state == SYSTEM_POWER_OFF) {
-               /* Prepare if we are going to power off the system */
+       switch (system_state) {
+       case SYSTEM_POWER_OFF:
+               /* Prepare to power off the system */
                return acpi_sleep_prepare(ACPI_STATE_S5);
+       case SYSTEM_SUSPEND_DISK:
+               /* Prepare to suspend the system to disk */
+               return acpi_sleep_prepare(ACPI_STATE_S4);
+       default:
+               return 0;
        }
-       return 0;
 }
 
 static struct sysdev_class acpi_sysclass = {