patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / drivers / acpi / events / evxface.c
index d2fe466..d33b990 100644 (file)
@@ -406,6 +406,15 @@ acpi_remove_notify_handler (
                        goto unlock_and_exit;
                }
 
+               /* Make sure all deferred tasks are completed */
+
+               (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+               acpi_os_wait_events_complete(NULL);
+               status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+               if (ACPI_FAILURE (status)) {
+                       return_ACPI_STATUS (status);
+               }
+
                if (handler_type == ACPI_SYSTEM_NOTIFY) {
                        acpi_gbl_system_notify.node  = NULL;
                        acpi_gbl_system_notify.handler = NULL;
@@ -452,6 +461,15 @@ acpi_remove_notify_handler (
                        goto unlock_and_exit;
                }
 
+               /* Make sure all deferred tasks are completed */
+
+               (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+               acpi_os_wait_events_complete(NULL);
+               status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+               if (ACPI_FAILURE (status)) {
+                       return_ACPI_STATUS (status);
+               }
+
                /* Remove the handler */
 
                if (handler_type == ACPI_SYSTEM_NOTIFY) {
@@ -614,6 +632,15 @@ acpi_remove_gpe_handler (
                goto unlock_and_exit;
        }
 
+       /* Make sure all deferred tasks are completed */
+
+       (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+       acpi_os_wait_events_complete(NULL);
+       status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
+       if (ACPI_FAILURE (status)) {
+               return_ACPI_STATUS (status);
+       }
+
        /* Remove the handler */
 
        acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);