Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh...
[pandora-kernel.git] / drivers / acpi / sleep / main.c
index aee50b4..37a0930 100644 (file)
@@ -105,6 +105,14 @@ static int acpi_pm_enter(suspend_state_t pm_state)
        default:
                return -EINVAL;
        }
+
+       /* ACPI 3.0 specs (P62) says that it's the responsabilty
+        * of the OSPM to clear the status bit [ implying that the
+        * POWER_BUTTON event should not reach userspace ]
+        */
+       if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3))
+               acpi_clear_event(ACPI_EVENT_POWER_BUTTON);
+
        local_irq_restore(flags);
        printk(KERN_DEBUG "Back to C!\n");
 
@@ -158,7 +166,15 @@ int acpi_suspend(u32 acpi_state)
        return -EINVAL;
 }
 
+static int acpi_pm_state_valid(suspend_state_t pm_state)
+{
+       u32 acpi_state = acpi_suspend_states[pm_state];
+
+       return sleep_states[acpi_state];
+}
+
 static struct pm_ops acpi_pm_ops = {
+       .valid = acpi_pm_state_valid,
        .prepare = acpi_pm_prepare,
        .enter = acpi_pm_enter,
        .finish = acpi_pm_finish,
@@ -184,7 +200,7 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
        {},
 };
 
-static int __init acpi_sleep_init(void)
+int __init acpi_sleep_init(void)
 {
        int i = 0;
 
@@ -213,4 +229,3 @@ static int __init acpi_sleep_init(void)
        return 0;
 }
 
-late_initcall(acpi_sleep_init);