]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ACPICA: Fix for update of the Global Lock Handle
authorBob Moore <robert.moore@intel.com>
Thu, 10 Apr 2008 15:06:38 +0000 (19:06 +0400)
committerLen Brown <len.brown@intel.com>
Tue, 22 Apr 2008 18:29:23 +0000 (14:29 -0400)
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>
drivers/acpi/events/evmisc.c
drivers/acpi/events/evxface.c

index 2d34663dc1ed640aba994b3b9be71b68370f3253..d075062f5b89ee35727c57dd94617aab7c6db4a7 100644 (file)
@@ -460,6 +460,19 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
        acpi_ev_global_lock_thread_id = acpi_os_get_thread_id();
        acpi_ev_global_lock_acquired++;
 
+       /*
+        * Update the global lock handle and check for wraparound. The handle is
+        * only used for the external global lock interfaces, but it is updated
+        * here to properly handle the case where a single thread may acquire the
+        * lock via both the AML and the acpi_acquire_global_lock interfaces. The
+        * handle is therefore updated on the first acquire from a given thread
+        * regardless of where the acquisition request originated.
+        */
+       acpi_gbl_global_lock_handle++;
+       if (acpi_gbl_global_lock_handle == 0) {
+               acpi_gbl_global_lock_handle = 1;
+       }
+
        /*
         * Make sure that a global lock actually exists. If not, just treat
         * the lock as a standard mutex.
index e210aa2d76da7b3f227f6b12d8517ccd43d2ff8d..412cae698311a06f5e0c0b556c9fae74e5556211 100644 (file)
@@ -782,15 +782,8 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
                                              acpi_os_get_thread_id());
 
        if (ACPI_SUCCESS(status)) {
-               /*
-                * 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 */
+               /* Return the global lock handle (updated in acpi_ev_acquire_global_lock) */
 
                *handle = acpi_gbl_global_lock_handle;
        }