aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/events
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/events')
-rw-r--r--drivers/acpi/events/evmisc.c11
-rw-r--r--drivers/acpi/events/evxface.c26
2 files changed, 28 insertions, 9 deletions
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c
index 21cb749d0c75..2d34663dc1ed 100644
--- a/drivers/acpi/events/evmisc.c
+++ b/drivers/acpi/events/evmisc.c
@@ -439,7 +439,8 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
439 * Only one thread can acquire the GL at a time, the global_lock_mutex 439 * Only one thread can acquire the GL at a time, the global_lock_mutex
440 * enforces this. This interface releases the interpreter if we must wait. 440 * enforces this. This interface releases the interpreter if we must wait.
441 */ 441 */
442 status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, 0); 442 status = acpi_ex_system_wait_mutex(
443 acpi_gbl_global_lock_mutex->mutex.os_mutex, 0);
443 if (status == AE_TIME) { 444 if (status == AE_TIME) {
444 if (acpi_ev_global_lock_thread_id == acpi_os_get_thread_id()) { 445 if (acpi_ev_global_lock_thread_id == acpi_os_get_thread_id()) {
445 acpi_ev_global_lock_acquired++; 446 acpi_ev_global_lock_acquired++;
@@ -448,9 +449,9 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
448 } 449 }
449 450
450 if (ACPI_FAILURE(status)) { 451 if (ACPI_FAILURE(status)) {
451 status = 452 status = acpi_ex_system_wait_mutex(
452 acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, 453 acpi_gbl_global_lock_mutex->mutex.os_mutex,
453 timeout); 454 timeout);
454 } 455 }
455 if (ACPI_FAILURE(status)) { 456 if (ACPI_FAILURE(status)) {
456 return_ACPI_STATUS(status); 457 return_ACPI_STATUS(status);
@@ -555,7 +556,7 @@ acpi_status acpi_ev_release_global_lock(void)
555 /* Release the local GL mutex */ 556 /* Release the local GL mutex */
556 acpi_ev_global_lock_thread_id = NULL; 557 acpi_ev_global_lock_thread_id = NULL;
557 acpi_ev_global_lock_acquired = 0; 558 acpi_ev_global_lock_acquired = 0;
558 acpi_os_release_mutex(acpi_gbl_global_lock_mutex); 559 acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex);
559 return_ACPI_STATUS(status); 560 return_ACPI_STATUS(status);
560} 561}
561 562
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
index 6d866a01f5f4..dbf34a5fc1e0 100644
--- a/drivers/acpi/events/evxface.c
+++ b/drivers/acpi/events/evxface.c
@@ -758,6 +758,12 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler)
758 * 758 *
759 * DESCRIPTION: Acquire the ACPI Global Lock 759 * DESCRIPTION: Acquire the ACPI Global Lock
760 * 760 *
761 * Note: Allows callers with the same thread ID to acquire the global lock
762 * multiple times. In other words, externally, the behavior of the global lock
763 * is identical to an AML mutex. On the first acquire, a new handle is
764 * returned. On any subsequent calls to acquire by the same thread, the same
765 * handle is returned.
766 *
761 ******************************************************************************/ 767 ******************************************************************************/
762acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) 768acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
763{ 769{
@@ -770,14 +776,26 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
770 /* Must lock interpreter to prevent race conditions */ 776 /* Must lock interpreter to prevent race conditions */
771 777
772 acpi_ex_enter_interpreter(); 778 acpi_ex_enter_interpreter();
773 status = acpi_ev_acquire_global_lock(timeout); 779
774 acpi_ex_exit_interpreter(); 780 status = acpi_ex_acquire_mutex_object(timeout,
781 acpi_gbl_global_lock_mutex,
782 acpi_os_get_thread_id());
775 783
776 if (ACPI_SUCCESS(status)) { 784 if (ACPI_SUCCESS(status)) {
777 acpi_gbl_global_lock_handle++; 785 /*
786 * If this was the first acquisition of the Global Lock by this thread,
787 * create a new handle. Otherwise, return the existing handle.
788 */
789 if (acpi_gbl_global_lock_mutex->mutex.acquisition_depth == 1) {
790 acpi_gbl_global_lock_handle++;
791 }
792
793 /* Return the global lock handle */
794
778 *handle = acpi_gbl_global_lock_handle; 795 *handle = acpi_gbl_global_lock_handle;
779 } 796 }
780 797
798 acpi_ex_exit_interpreter();
781 return (status); 799 return (status);
782} 800}
783 801
@@ -802,7 +820,7 @@ acpi_status acpi_release_global_lock(u32 handle)
802 return (AE_NOT_ACQUIRED); 820 return (AE_NOT_ACQUIRED);
803 } 821 }
804 822
805 status = acpi_ev_release_global_lock(); 823 status = acpi_ex_release_mutex_object(acpi_gbl_global_lock_mutex);
806 return (status); 824 return (status);
807} 825}
808 826