X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Facpi%2Fevents%2Fevxface.c;h=923fd2b46955284a99a2baaa29eeec9c8086e45d;hb=refs%2Fheads%2Fvserver;hp=b38b39dde54318619a29268bebf4ec6bb61df56c;hpb=64ba3f394c830ec48a1c31b53dcae312c56f1604;p=linux-2.6.git diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index b38b39dde..923fd2b46 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include #include @@ -68,7 +66,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)) { @@ -90,6 +88,8 @@ 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,14 +107,13 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler 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 */ @@ -161,7 +160,7 @@ acpi_install_fixed_event_handler(u32 event, return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_install_fixed_event_handler); +ACPI_EXPORT_SYMBOL(acpi_install_fixed_event_handler) /******************************************************************************* * @@ -175,13 +174,12 @@ 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 */ @@ -216,7 +214,7 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_remove_fixed_event_handler); +ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler) /******************************************************************************* * @@ -235,7 +233,6 @@ 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, @@ -246,7 +243,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 */ @@ -275,6 +272,7 @@ acpi_install_notify_handler(acpi_handle device, * only one 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) && @@ -317,6 +315,7 @@ 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) && @@ -370,6 +369,7 @@ 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); } -EXPORT_SYMBOL(acpi_install_notify_handler); +ACPI_EXPORT_SYMBOL(acpi_install_notify_handler) /******************************************************************************* * @@ -399,7 +399,6 @@ 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) @@ -409,18 +408,19 @@ 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)) { - 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 */ @@ -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)) { - return_ACPI_STATUS(status); + goto exit; } if (handler_type & ACPI_SYSTEM_NOTIFY) { @@ -489,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; } @@ -500,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 */ @@ -510,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; } @@ -521,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 */ @@ -532,10 +540,13 @@ 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); } -EXPORT_SYMBOL(acpi_remove_notify_handler); +ACPI_EXPORT_SYMBOL(acpi_remove_notify_handler) /******************************************************************************* * @@ -554,7 +565,6 @@ 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, @@ -565,17 +575,18 @@ 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)) { - 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 */ @@ -596,7 +607,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, /* Allocate and init handler object */ - handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info)); + handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); if (!handler) { status = AE_NO_MEMORY; goto unlock_and_exit; @@ -627,10 +638,14 @@ 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); } -EXPORT_SYMBOL(acpi_install_gpe_handler); +ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) /******************************************************************************* * @@ -646,7 +661,6 @@ 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) @@ -656,7 +670,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 */ @@ -724,14 +738,14 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, /* Now we can free the handler object */ - ACPI_MEM_FREE(handler); + ACPI_FREE(handler); unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_ACPI_STATUS(status); } -EXPORT_SYMBOL(acpi_remove_gpe_handler); +ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler) /******************************************************************************* * @@ -746,7 +760,6 @@ 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; @@ -771,7 +784,7 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) return (status); } -EXPORT_SYMBOL(acpi_acquire_global_lock); +ACPI_EXPORT_SYMBOL(acpi_acquire_global_lock) /******************************************************************************* * @@ -784,7 +797,6 @@ 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; @@ -797,4 +809,4 @@ acpi_status acpi_release_global_lock(u32 handle) return (status); } -EXPORT_SYMBOL(acpi_release_global_lock); +ACPI_EXPORT_SYMBOL(acpi_release_global_lock)