linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / acpi / events / evxface.c
index 923fd2b..b38b39d 100644 (file)
@@ -41,6 +41,8 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
+#include <linux/module.h>
+
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acevents.h>
@@ -66,7 +68,7 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE(acpi_install_exception_handler);
+       ACPI_FUNCTION_TRACE("acpi_install_exception_handler");
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
        if (ACPI_FAILURE(status)) {
@@ -88,8 +90,6 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler)
        (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
        return_ACPI_STATUS(status);
 }
-
-ACPI_EXPORT_SYMBOL(acpi_install_exception_handler)
 #endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
@@ -107,13 +107,14 @@ ACPI_EXPORT_SYMBOL(acpi_install_exception_handler)
  *              event.
  *
  ******************************************************************************/
+
 acpi_status
 acpi_install_fixed_event_handler(u32 event,
                                 acpi_event_handler handler, void *context)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE(acpi_install_fixed_event_handler);
+       ACPI_FUNCTION_TRACE("acpi_install_fixed_event_handler");
 
        /* Parameter validation */
 
@@ -160,7 +161,7 @@ acpi_install_fixed_event_handler(u32 event,
        return_ACPI_STATUS(status);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_install_fixed_event_handler)
+EXPORT_SYMBOL(acpi_install_fixed_event_handler);
 
 /*******************************************************************************
  *
@@ -174,12 +175,13 @@ ACPI_EXPORT_SYMBOL(acpi_install_fixed_event_handler)
  * DESCRIPTION: Disables the event and unregisters the event handler.
  *
  ******************************************************************************/
+
 acpi_status
 acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE(acpi_remove_fixed_event_handler);
+       ACPI_FUNCTION_TRACE("acpi_remove_fixed_event_handler");
 
        /* Parameter validation */
 
@@ -214,7 +216,7 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
        return_ACPI_STATUS(status);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler)
+EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
 
 /*******************************************************************************
  *
@@ -233,6 +235,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler)
  * DESCRIPTION: Install a handler for notifies on an ACPI device
  *
  ******************************************************************************/
+
 acpi_status
 acpi_install_notify_handler(acpi_handle device,
                            u32 handler_type,
@@ -243,7 +246,7 @@ acpi_install_notify_handler(acpi_handle device,
        struct acpi_namespace_node *node;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE(acpi_install_notify_handler);
+       ACPI_FUNCTION_TRACE("acpi_install_notify_handler");
 
        /* Parameter validation */
 
@@ -272,7 +275,6 @@ acpi_install_notify_handler(acpi_handle device,
         * only one <external> global handler can be regsitered (per notify type).
         */
        if (device == ACPI_ROOT_OBJECT) {
-
                /* Make sure the handler is not already installed */
 
                if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
@@ -315,7 +317,6 @@ acpi_install_notify_handler(acpi_handle device,
 
                obj_desc = acpi_ns_get_attached_object(node);
                if (obj_desc) {
-
                        /* Object exists - make sure there's no handler */
 
                        if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
@@ -369,7 +370,6 @@ acpi_install_notify_handler(acpi_handle device,
                }
 
                if (handler_type == ACPI_ALL_NOTIFY) {
-
                        /* Extra ref if installed in both */
 
                        acpi_ut_add_reference(notify_obj);
@@ -381,7 +381,7 @@ acpi_install_notify_handler(acpi_handle device,
        return_ACPI_STATUS(status);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_install_notify_handler)
+EXPORT_SYMBOL(acpi_install_notify_handler);
 
 /*******************************************************************************
  *
@@ -399,6 +399,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_notify_handler)
  * DESCRIPTION: Remove a handler for notifies on an ACPI device
  *
  ******************************************************************************/
+
 acpi_status
 acpi_remove_notify_handler(acpi_handle device,
                           u32 handler_type, acpi_notify_handler handler)
@@ -408,19 +409,18 @@ acpi_remove_notify_handler(acpi_handle device,
        struct acpi_namespace_node *node;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE(acpi_remove_notify_handler);
+       ACPI_FUNCTION_TRACE("acpi_remove_notify_handler");
 
        /* Parameter validation */
 
        if ((!device) ||
            (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
-               status = AE_BAD_PARAMETER;
-               goto exit;
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
        if (ACPI_FAILURE(status)) {
-               goto exit;
+               return_ACPI_STATUS(status);
        }
 
        /* Convert and validate the device handle */
@@ -451,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)) {
-                       goto exit;
+                       return_ACPI_STATUS(status);
                }
 
                if (handler_type & ACPI_SYSTEM_NOTIFY) {
@@ -489,12 +489,8 @@ acpi_remove_notify_handler(acpi_handle device,
 
                if (handler_type & ACPI_SYSTEM_NOTIFY) {
                        notify_obj = obj_desc->common_notify.system_notify;
-                       if (!notify_obj) {
-                               status = AE_NOT_EXIST;
-                               goto unlock_and_exit;
-                       }
-
-                       if (notify_obj->notify.handler != handler) {
+                       if ((!notify_obj) ||
+                           (notify_obj->notify.handler != handler)) {
                                status = AE_BAD_PARAMETER;
                                goto unlock_and_exit;
                        }
@@ -504,7 +500,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)) {
-                               goto exit;
+                               return_ACPI_STATUS(status);
                        }
 
                        /* Remove the handler */
@@ -514,12 +510,8 @@ acpi_remove_notify_handler(acpi_handle device,
 
                if (handler_type & ACPI_DEVICE_NOTIFY) {
                        notify_obj = obj_desc->common_notify.device_notify;
-                       if (!notify_obj) {
-                               status = AE_NOT_EXIST;
-                               goto unlock_and_exit;
-                       }
-
-                       if (notify_obj->notify.handler != handler) {
+                       if ((!notify_obj) ||
+                           (notify_obj->notify.handler != handler)) {
                                status = AE_BAD_PARAMETER;
                                goto unlock_and_exit;
                        }
@@ -529,7 +521,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)) {
-                               goto exit;
+                               return_ACPI_STATUS(status);
                        }
 
                        /* Remove the handler */
@@ -540,13 +532,10 @@ 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);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_remove_notify_handler)
+EXPORT_SYMBOL(acpi_remove_notify_handler);
 
 /*******************************************************************************
  *
@@ -565,6 +554,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_notify_handler)
  * DESCRIPTION: Install a handler for a General Purpose Event.
  *
  ******************************************************************************/
+
 acpi_status
 acpi_install_gpe_handler(acpi_handle gpe_device,
                         u32 gpe_number,
@@ -575,18 +565,17 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
        acpi_status status;
        acpi_cpu_flags flags;
 
-       ACPI_FUNCTION_TRACE(acpi_install_gpe_handler);
+       ACPI_FUNCTION_TRACE("acpi_install_gpe_handler");
 
        /* Parameter validation */
 
        if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) {
-               status = AE_BAD_PARAMETER;
-               goto exit;
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
        if (ACPI_FAILURE(status)) {
-               goto exit;
+               return_ACPI_STATUS(status);
        }
 
        /* Ensure that we have a valid GPE number */
@@ -607,7 +596,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
 
        /* Allocate and init handler object */
 
-       handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info));
+       handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info));
        if (!handler) {
                status = AE_NO_MEMORY;
                goto unlock_and_exit;
@@ -638,14 +627,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);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler)
+EXPORT_SYMBOL(acpi_install_gpe_handler);
 
 /*******************************************************************************
  *
@@ -661,6 +646,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler)
  * DESCRIPTION: Remove a handler for a General Purpose acpi_event.
  *
  ******************************************************************************/
+
 acpi_status
 acpi_remove_gpe_handler(acpi_handle gpe_device,
                        u32 gpe_number, acpi_event_handler address)
@@ -670,7 +656,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
        acpi_status status;
        acpi_cpu_flags flags;
 
-       ACPI_FUNCTION_TRACE(acpi_remove_gpe_handler);
+       ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler");
 
        /* Parameter validation */
 
@@ -738,14 +724,14 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
 
        /* Now we can free the handler object */
 
-       ACPI_FREE(handler);
+       ACPI_MEM_FREE(handler);
 
       unlock_and_exit:
        (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
        return_ACPI_STATUS(status);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler)
+EXPORT_SYMBOL(acpi_remove_gpe_handler);
 
 /*******************************************************************************
  *
@@ -760,6 +746,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler)
  * DESCRIPTION: Acquire the ACPI Global Lock
  *
  ******************************************************************************/
+
 acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
 {
        acpi_status status;
@@ -784,7 +771,7 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
        return (status);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_acquire_global_lock)
+EXPORT_SYMBOL(acpi_acquire_global_lock);
 
 /*******************************************************************************
  *
@@ -797,6 +784,7 @@ ACPI_EXPORT_SYMBOL(acpi_acquire_global_lock)
  * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid.
  *
  ******************************************************************************/
+
 acpi_status acpi_release_global_lock(u32 handle)
 {
        acpi_status status;
@@ -809,4 +797,4 @@ acpi_status acpi_release_global_lock(u32 handle)
        return (status);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_release_global_lock)
+EXPORT_SYMBOL(acpi_release_global_lock);