Pull asus into release branch
[pandora-kernel.git] / drivers / acpi / events / evxface.c
index 76c34a6..a3379ba 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2006, R. Byron Moore
+ * Copyright (C) 2000 - 2007, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -414,12 +414,13 @@ acpi_remove_notify_handler(acpi_handle device,
 
        if ((!device) ||
            (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
+               status = AE_BAD_PARAMETER;
+               goto exit;
        }
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
        if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
+               goto exit;
        }
 
        /* Convert and validate the device handle */
@@ -450,7 +451,7 @@ acpi_remove_notify_handler(acpi_handle device,
                acpi_os_wait_events_complete(NULL);
                status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
                if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
+                       goto exit;
                }
 
                if (handler_type & ACPI_SYSTEM_NOTIFY) {
@@ -488,8 +489,12 @@ acpi_remove_notify_handler(acpi_handle device,
 
                if (handler_type & ACPI_SYSTEM_NOTIFY) {
                        notify_obj = obj_desc->common_notify.system_notify;
-                       if ((!notify_obj) ||
-                           (notify_obj->notify.handler != handler)) {
+                       if (!notify_obj) {
+                               status = AE_NOT_EXIST;
+                               goto unlock_and_exit;
+                       }
+
+                       if (notify_obj->notify.handler != handler) {
                                status = AE_BAD_PARAMETER;
                                goto unlock_and_exit;
                        }
@@ -499,7 +504,7 @@ acpi_remove_notify_handler(acpi_handle device,
                        acpi_os_wait_events_complete(NULL);
                        status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
                        if (ACPI_FAILURE(status)) {
-                               return_ACPI_STATUS(status);
+                               goto exit;
                        }
 
                        /* Remove the handler */
@@ -509,8 +514,12 @@ acpi_remove_notify_handler(acpi_handle device,
 
                if (handler_type & ACPI_DEVICE_NOTIFY) {
                        notify_obj = obj_desc->common_notify.device_notify;
-                       if ((!notify_obj) ||
-                           (notify_obj->notify.handler != handler)) {
+                       if (!notify_obj) {
+                               status = AE_NOT_EXIST;
+                               goto unlock_and_exit;
+                       }
+
+                       if (notify_obj->notify.handler != handler) {
                                status = AE_BAD_PARAMETER;
                                goto unlock_and_exit;
                        }
@@ -520,7 +529,7 @@ acpi_remove_notify_handler(acpi_handle device,
                        acpi_os_wait_events_complete(NULL);
                        status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
                        if (ACPI_FAILURE(status)) {
-                               return_ACPI_STATUS(status);
+                               goto exit;
                        }
 
                        /* Remove the handler */
@@ -531,6 +540,9 @@ acpi_remove_notify_handler(acpi_handle device,
 
       unlock_and_exit:
        (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+      exit:
+       if (ACPI_FAILURE(status))
+               ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler"));
        return_ACPI_STATUS(status);
 }
 
@@ -568,12 +580,13 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
        /* Parameter validation */
 
        if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) {
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
+               status = AE_BAD_PARAMETER;
+               goto exit;
        }
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
        if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
+               goto exit;
        }
 
        /* Ensure that we have a valid GPE number */
@@ -625,6 +638,10 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
 
       unlock_and_exit:
        (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+      exit:
+       if (ACPI_FAILURE(status))
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "Installing notify handler failed"));
        return_ACPI_STATUS(status);
 }