]> err.no Git - linux-2.6/commitdiff
ACPI: acpi_os_get_thread_id() returns current
authorLen Brown <len.brown@intel.com>
Sat, 8 Jul 2006 00:11:07 +0000 (20:11 -0400)
committerLen Brown <len.brown@intel.com>
Sun, 9 Jul 2006 19:19:44 +0000 (15:19 -0400)
Linux mutexes and the debug code that that reference
acpi_os_get_thread_id() are happy with 0.
But the AML mutexes in exmutex.c expect a unique non-zero
number for each thread - as they track this thread_id
to permit the mutex re-entrancy defined by the ACPI spec.

http://bugzilla.kernel.org/show_bug.cgi?id=6687

Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/executer/exmutex.c
drivers/acpi/utilities/utdebug.c
drivers/acpi/utilities/utmutex.c
include/acpi/aclocal.h
include/acpi/platform/aclinux.h

index d8ac2877cf05039574019ca20fd39cedec4ffc04..3a39c2e8e104a001c22f3cc18adab681b598497d 100644 (file)
@@ -267,9 +267,9 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
            && (obj_desc->mutex.os_mutex != ACPI_GLOBAL_LOCK)) {
                ACPI_ERROR((AE_INFO,
                            "Thread %X cannot release Mutex [%4.4s] acquired by thread %X",
-                           walk_state->thread->thread_id,
+                           (u32) walk_state->thread->thread_id,
                            acpi_ut_get_node_name(obj_desc->mutex.node),
-                           obj_desc->mutex.owner_thread->thread_id));
+                           (u32) obj_desc->mutex.owner_thread->thread_id));
                return_ACPI_STATUS(AE_AML_NOT_OWNER);
        }
 
index 5ec1cfcc611d2bc2203d2ccc9b1dc7f7dfc36442..bb1eaf9aa65370e4b30889159178713ad2fa346e 100644 (file)
@@ -47,7 +47,7 @@
 ACPI_MODULE_NAME("utdebug")
 
 #ifdef ACPI_DEBUG_OUTPUT
-static u32 acpi_gbl_prev_thread_id = 0xFFFFFFFF;
+static acpi_thread_id acpi_gbl_prev_thread_id;
 static char *acpi_gbl_fn_entry_str = "----Entry";
 static char *acpi_gbl_fn_exit_str = "----Exit-";
 
@@ -181,7 +181,7 @@ acpi_ut_debug_print(u32 requested_debug_level,
                if (ACPI_LV_THREADS & acpi_dbg_level) {
                        acpi_os_printf
                            ("\n**** Context Switch from TID %X to TID %X ****\n\n",
-                            acpi_gbl_prev_thread_id, thread_id);
+                            (u32) acpi_gbl_prev_thread_id, (u32) thread_id);
                }
 
                acpi_gbl_prev_thread_id = thread_id;
index dfc8f30ca892d13255a78d1cbaa622de4a2dbb38..c39062a047cd5c65b86aef83b9a11174e9e93a4e 100644 (file)
@@ -244,14 +244,14 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
 
        ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
                          "Thread %X attempting to acquire Mutex [%s]\n",
-                         this_thread_id, acpi_ut_get_mutex_name(mutex_id)));
+                         (u32) this_thread_id, acpi_ut_get_mutex_name(mutex_id)));
 
        status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex,
                                       ACPI_WAIT_FOREVER);
        if (ACPI_SUCCESS(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
                                  "Thread %X acquired Mutex [%s]\n",
-                                 this_thread_id,
+                                 (u32) this_thread_id,
                                  acpi_ut_get_mutex_name(mutex_id)));
 
                acpi_gbl_mutex_info[mutex_id].use_count++;
@@ -259,7 +259,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
        } else {
                ACPI_EXCEPTION((AE_INFO, status,
                                "Thread %X could not acquire Mutex [%X]",
-                               this_thread_id, mutex_id));
+                               (u32) this_thread_id, mutex_id));
        }
 
        return (status);
@@ -285,7 +285,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
 
        this_thread_id = acpi_os_get_thread_id();
        ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
-                         "Thread %X releasing Mutex [%s]\n", this_thread_id,
+                         "Thread %X releasing Mutex [%s]\n", (u32) this_thread_id,
                          acpi_ut_get_mutex_name(mutex_id)));
 
        if (mutex_id > ACPI_MAX_MUTEX) {
index 56b8024861611ed6d77a8705801b260a07cfeda9..fbafee6e56d32bbd9d8b05437a434182c269a769 100644 (file)
@@ -127,7 +127,7 @@ typedef u8 acpi_owner_id;
 
 /* This Thread ID means that the mutex is not in use (unlocked) */
 
-#define ACPI_MUTEX_NOT_ACQUIRED         (u32) -1
+#define ACPI_MUTEX_NOT_ACQUIRED         (acpi_thread_id) 0
 
 /* Table for the global mutexes */
 
index 3f853cabbd4159d7e905e8955864171cabdd70d3..1cb51bf96ece64d4995666989c200e7bc8ec0812 100644 (file)
@@ -59,6 +59,7 @@
 #include <asm/acpi.h>
 #include <linux/slab.h>
 #include <linux/spinlock_types.h>
+#include <asm/current.h>
 
 /* Host-dependent types and defines */
 
 
 #define acpi_cpu_flags unsigned long
 
-#define acpi_thread_id u32
+#define acpi_thread_id struct task_struct *
 
-static inline acpi_thread_id acpi_os_get_thread_id(void) { return 0; }
+static inline acpi_thread_id acpi_os_get_thread_id(void) { return current; }
 
 #endif                         /* __ACLINUX_H__ */