Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[pandora-kernel.git] / drivers / acpi / sleep / poweroff.c
index 186b182..39e40d5 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,16 +32,20 @@ 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;
 }
 
 #ifdef CONFIG_PM
 
-void acpi_power_off(void)
+static void acpi_power_off_prepare(void)
+{
+       /* Prepare to power off the system */
+       acpi_sleep_prepare(ACPI_STATE_S5);
+}
+
+static void acpi_power_off(void)
 {
        /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
        printk("%s called\n", __FUNCTION__);
@@ -53,21 +54,6 @@ void acpi_power_off(void)
        acpi_enter_sleep_state(ACPI_STATE_S5);
 }
 
-static int acpi_shutdown(struct sys_device *x)
-{
-       return acpi_sleep_prepare(ACPI_STATE_S5);
-}
-
-static struct sysdev_class acpi_sysclass = {
-       set_kset_name("acpi"),
-       .shutdown = acpi_shutdown
-};
-
-static struct sys_device device_acpi = {
-       .id = 0,
-       .cls = &acpi_sysclass,
-};
-
 static int acpi_poweroff_init(void)
 {
        if (!acpi_disabled) {
@@ -77,13 +63,8 @@ static int acpi_poweroff_init(void)
                status =
                    acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
                if (ACPI_SUCCESS(status)) {
-                       int error;
-                       error = sysdev_class_register(&acpi_sysclass);
-                       if (!error)
-                               error = sysdev_register(&device_acpi);
-                       if (!error)
-                               pm_power_off = acpi_power_off;
-                       return error;
+                       pm_power_off_prepare = acpi_power_off_prepare;
+                       pm_power_off = acpi_power_off;
                }
        }
        return 0;
@@ -91,4 +72,4 @@ static int acpi_poweroff_init(void)
 
 late_initcall(acpi_poweroff_init);
 
-#endif /* CONFIG_PM */
+#endif                         /* CONFIG_PM */