Pull events into release branch
[sfrench/cifs-2.6.git] / drivers / acpi / hardware / hwsleep.c
index 8fa93125fd4c94af822bf9b6dd1863511de16b7a..cf69c0040a390d407d0cd2b2da6c4e21882e22af 100644 (file)
@@ -152,7 +152,6 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
 
 ACPI_EXPORT_SYMBOL(acpi_get_firmware_waking_vector)
 #endif
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state_prep
@@ -300,6 +299,11 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
        /*
         * 2) Enable all wakeup GPEs
         */
+       status = acpi_hw_disable_all_gpes();
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
        acpi_gbl_system_awake_and_running = FALSE;
 
        status = acpi_hw_enable_all_wakeup_gpes();
@@ -572,13 +576,10 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
                ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS"));
        }
 
-       status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL);
-       if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
-               ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK"));
-       }
-       /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
-
        /*
+        * GPEs must be enabled before _WAK is called as GPEs
+        * might get fired there
+        *
         * Restore the GPEs:
         * 1) Disable/Clear all GPEs
         * 2) Enable all runtime GPEs
@@ -587,13 +588,19 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
-       acpi_gbl_system_awake_and_running = TRUE;
-
        status = acpi_hw_enable_all_runtime_gpes();
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
 
+       status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL);
+       if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+               ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK"));
+       }
+       /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
+
+       acpi_gbl_system_awake_and_running = TRUE;
+
        /* Enable power button */
 
        (void)