aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi/events/evxface.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/events/evxface.c')
-rw-r--r--drivers/acpi/events/evxface.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
index 6d866a01f5f..dbf34a5fc1e 100644
--- a/drivers/acpi/events/evxface.c
+++ b/drivers/acpi/events/evxface.c
@@ -758,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)
{
@@ -770,14 +776,26 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
/* Must lock interpreter to prevent race conditions */
acpi_ex_enter_interpreter();
- status = acpi_ev_acquire_global_lock(timeout);
- acpi_ex_exit_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++;
+ /*
+ * If this was the first acquisition of the Global Lock by this thread,
+ * create a new handle. Otherwise, return the existing handle.
+ */
+ if (acpi_gbl_global_lock_mutex->mutex.acquisition_depth == 1) {
+ acpi_gbl_global_lock_handle++;
+ }
+
+ /* Return the global lock handle */
+
*handle = acpi_gbl_global_lock_handle;
}
+ acpi_ex_exit_interpreter();
return (status);
}
@@ -802,7 +820,7 @@ acpi_status acpi_release_global_lock(u32 handle)
return (AE_NOT_ACQUIRED);
}
- status = acpi_ev_release_global_lock();
+ status = acpi_ex_release_mutex_object(acpi_gbl_global_lock_mutex);
return (status);
}