diff options
author | Bob Moore <robert.moore@intel.com> | 2008-04-10 11:06:38 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-22 14:29:23 -0400 |
commit | e5567afa5cfa19e45f93c9c8796e46187a2d12f4 (patch) | |
tree | ab02e06e8a7aad960b1188b5211c1ed9d3631cf0 /drivers/acpi/events | |
parent | 235eebbdb501261e9960deb2a9a3459af44ec0ea (diff) |
ACPICA: Fix for update of the Global Lock Handle
Fixed a problem where the global lock handle was not properly
updated if a thread that acquired the global lock via
executing AML code then attempted to acquire the lock via the
AcpiAcquireGlobalLock interface.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/events')
-rw-r--r-- | drivers/acpi/events/evmisc.c | 13 | ||||
-rw-r--r-- | drivers/acpi/events/evxface.c | 9 |
2 files changed, 14 insertions, 8 deletions
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 2d34663dc1ed..d075062f5b89 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -461,6 +461,19 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
461 | acpi_ev_global_lock_acquired++; | 461 | acpi_ev_global_lock_acquired++; |
462 | 462 | ||
463 | /* | 463 | /* |
464 | * Update the global lock handle and check for wraparound. The handle is | ||
465 | * only used for the external global lock interfaces, but it is updated | ||
466 | * here to properly handle the case where a single thread may acquire the | ||
467 | * lock via both the AML and the acpi_acquire_global_lock interfaces. The | ||
468 | * handle is therefore updated on the first acquire from a given thread | ||
469 | * regardless of where the acquisition request originated. | ||
470 | */ | ||
471 | acpi_gbl_global_lock_handle++; | ||
472 | if (acpi_gbl_global_lock_handle == 0) { | ||
473 | acpi_gbl_global_lock_handle = 1; | ||
474 | } | ||
475 | |||
476 | /* | ||
464 | * Make sure that a global lock actually exists. If not, just treat | 477 | * Make sure that a global lock actually exists. If not, just treat |
465 | * the lock as a standard mutex. | 478 | * the lock as a standard mutex. |
466 | */ | 479 | */ |
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index e210aa2d76da..412cae698311 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -782,15 +782,8 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | |||
782 | acpi_os_get_thread_id()); | 782 | acpi_os_get_thread_id()); |
783 | 783 | ||
784 | if (ACPI_SUCCESS(status)) { | 784 | if (ACPI_SUCCESS(status)) { |
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 | 785 | ||
793 | /* Return the global lock handle */ | 786 | /* Return the global lock handle (updated in acpi_ev_acquire_global_lock) */ |
794 | 787 | ||
795 | *handle = acpi_gbl_global_lock_handle; | 788 | *handle = acpi_gbl_global_lock_handle; |
796 | } | 789 | } |