X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Facpi%2Fevents%2Fevxface.c;h=94a6efe020bed116118c408e92f35f30a0d23a2e;hb=236b8082aa239e91c3cd9cb466d0527a735e54db;hp=a3379bafa676dc7da65fd71aeed1db5091ad7de7;hpb=604119a4b22b95e30dea6af3b3bfdc2f07fa4afd;p=linux-2.6-omap-h63xx.git diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index a3379bafa67..94a6efe020b 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2007, R. Byron Moore + * Copyright (C) 2000 - 2008, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -91,7 +91,6 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) ACPI_EXPORT_SYMBOL(acpi_install_exception_handler) #endif /* ACPI_FUTURE_USAGE */ - /******************************************************************************* * * FUNCTION: acpi_install_fixed_event_handler @@ -759,6 +758,12 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler) * * DESCRIPTION: Acquire the ACPI Global Lock * + * Note: Allows callers with the same thread ID to acquire the global lock + * multiple times. In other words, externally, the behavior of the global lock + * is identical to an AML mutex. On the first acquire, a new handle is + * returned. On any subsequent calls to acquire by the same thread, the same + * handle is returned. + * ******************************************************************************/ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) { @@ -768,19 +773,22 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) return (AE_BAD_PARAMETER); } - status = acpi_ex_enter_interpreter(); - if (ACPI_FAILURE(status)) { - return (status); - } + /* Must lock interpreter to prevent race conditions */ - status = acpi_ev_acquire_global_lock(timeout); - acpi_ex_exit_interpreter(); + acpi_ex_enter_interpreter(); + + status = acpi_ex_acquire_mutex_object(timeout, + acpi_gbl_global_lock_mutex, + acpi_os_get_thread_id()); if (ACPI_SUCCESS(status)) { - acpi_gbl_global_lock_handle++; + + /* Return the global lock handle (updated in acpi_ev_acquire_global_lock) */ + *handle = acpi_gbl_global_lock_handle; } + acpi_ex_exit_interpreter(); return (status); } @@ -801,11 +809,11 @@ acpi_status acpi_release_global_lock(u32 handle) { acpi_status status; - if (handle != acpi_gbl_global_lock_handle) { + if (!handle || (handle != acpi_gbl_global_lock_handle)) { return (AE_NOT_ACQUIRED); } - status = acpi_ev_release_global_lock(); + status = acpi_ex_release_mutex_object(acpi_gbl_global_lock_mutex); return (status); }