diff options
Diffstat (limited to 'drivers/acpi/acpica/utmutex.c')
-rw-r--r-- | drivers/acpi/acpica/utmutex.c | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index f5cca3a1300c..7d797e2baecd 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2010, Intel Corp. | 8 | * Copyright (C) 2000 - 2011, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -83,8 +83,21 @@ acpi_status acpi_ut_mutex_initialize(void) | |||
83 | 83 | ||
84 | /* Create the spinlocks for use at interrupt level */ | 84 | /* Create the spinlocks for use at interrupt level */ |
85 | 85 | ||
86 | spin_lock_init(acpi_gbl_gpe_lock); | 86 | status = acpi_os_create_lock (&acpi_gbl_gpe_lock); |
87 | spin_lock_init(acpi_gbl_hardware_lock); | 87 | if (ACPI_FAILURE (status)) { |
88 | return_ACPI_STATUS (status); | ||
89 | } | ||
90 | |||
91 | status = acpi_os_create_lock (&acpi_gbl_hardware_lock); | ||
92 | if (ACPI_FAILURE (status)) { | ||
93 | return_ACPI_STATUS (status); | ||
94 | } | ||
95 | |||
96 | /* Mutex for _OSI support */ | ||
97 | status = acpi_os_create_mutex(&acpi_gbl_osi_mutex); | ||
98 | if (ACPI_FAILURE(status)) { | ||
99 | return_ACPI_STATUS(status); | ||
100 | } | ||
88 | 101 | ||
89 | /* Create the reader/writer lock for namespace access */ | 102 | /* Create the reader/writer lock for namespace access */ |
90 | 103 | ||
@@ -117,6 +130,8 @@ void acpi_ut_mutex_terminate(void) | |||
117 | acpi_ut_delete_mutex(i); | 130 | acpi_ut_delete_mutex(i); |
118 | } | 131 | } |
119 | 132 | ||
133 | acpi_os_delete_mutex(acpi_gbl_osi_mutex); | ||
134 | |||
120 | /* Delete the spinlocks */ | 135 | /* Delete the spinlocks */ |
121 | 136 | ||
122 | acpi_os_delete_lock(acpi_gbl_gpe_lock); | 137 | acpi_os_delete_lock(acpi_gbl_gpe_lock); |
@@ -220,18 +235,17 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
220 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { | 235 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
221 | if (i == mutex_id) { | 236 | if (i == mutex_id) { |
222 | ACPI_ERROR((AE_INFO, | 237 | ACPI_ERROR((AE_INFO, |
223 | "Mutex [%s] already acquired by this thread [%p]", | 238 | "Mutex [%s] already acquired by this thread [%u]", |
224 | acpi_ut_get_mutex_name | 239 | acpi_ut_get_mutex_name |
225 | (mutex_id), | 240 | (mutex_id), |
226 | ACPI_CAST_PTR(void, | 241 | (u32)this_thread_id)); |
227 | this_thread_id))); | ||
228 | 242 | ||
229 | return (AE_ALREADY_ACQUIRED); | 243 | return (AE_ALREADY_ACQUIRED); |
230 | } | 244 | } |
231 | 245 | ||
232 | ACPI_ERROR((AE_INFO, | 246 | ACPI_ERROR((AE_INFO, |
233 | "Invalid acquire order: Thread %p owns [%s], wants [%s]", | 247 | "Invalid acquire order: Thread %u owns [%s], wants [%s]", |
234 | ACPI_CAST_PTR(void, this_thread_id), | 248 | (u32)this_thread_id, |
235 | acpi_ut_get_mutex_name(i), | 249 | acpi_ut_get_mutex_name(i), |
236 | acpi_ut_get_mutex_name(mutex_id))); | 250 | acpi_ut_get_mutex_name(mutex_id))); |
237 | 251 | ||
@@ -242,24 +256,24 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
242 | #endif | 256 | #endif |
243 | 257 | ||
244 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 258 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
245 | "Thread %p attempting to acquire Mutex [%s]\n", | 259 | "Thread %u attempting to acquire Mutex [%s]\n", |
246 | ACPI_CAST_PTR(void, this_thread_id), | 260 | (u32)this_thread_id, |
247 | acpi_ut_get_mutex_name(mutex_id))); | 261 | acpi_ut_get_mutex_name(mutex_id))); |
248 | 262 | ||
249 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, | 263 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, |
250 | ACPI_WAIT_FOREVER); | 264 | ACPI_WAIT_FOREVER); |
251 | if (ACPI_SUCCESS(status)) { | 265 | if (ACPI_SUCCESS(status)) { |
252 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 266 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
253 | "Thread %p acquired Mutex [%s]\n", | 267 | "Thread %u acquired Mutex [%s]\n", |
254 | ACPI_CAST_PTR(void, this_thread_id), | 268 | (u32)this_thread_id, |
255 | acpi_ut_get_mutex_name(mutex_id))); | 269 | acpi_ut_get_mutex_name(mutex_id))); |
256 | 270 | ||
257 | acpi_gbl_mutex_info[mutex_id].use_count++; | 271 | acpi_gbl_mutex_info[mutex_id].use_count++; |
258 | acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; | 272 | acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; |
259 | } else { | 273 | } else { |
260 | ACPI_EXCEPTION((AE_INFO, status, | 274 | ACPI_EXCEPTION((AE_INFO, status, |
261 | "Thread %p could not acquire Mutex [0x%X]", | 275 | "Thread %u could not acquire Mutex [0x%X]", |
262 | ACPI_CAST_PTR(void, this_thread_id), mutex_id)); | 276 | (u32)this_thread_id, mutex_id)); |
263 | } | 277 | } |
264 | 278 | ||
265 | return (status); | 279 | return (status); |
@@ -279,10 +293,14 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
279 | 293 | ||
280 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | 294 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) |
281 | { | 295 | { |
296 | acpi_thread_id this_thread_id; | ||
297 | |||
282 | ACPI_FUNCTION_NAME(ut_release_mutex); | 298 | ACPI_FUNCTION_NAME(ut_release_mutex); |
283 | 299 | ||
284 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n", | 300 | this_thread_id = acpi_os_get_thread_id(); |
285 | ACPI_CAST_PTR(void, acpi_os_get_thread_id()), | 301 | |
302 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n", | ||
303 | (u32)this_thread_id, | ||
286 | acpi_ut_get_mutex_name(mutex_id))); | 304 | acpi_ut_get_mutex_name(mutex_id))); |
287 | 305 | ||
288 | if (mutex_id > ACPI_MAX_MUTEX) { | 306 | if (mutex_id > ACPI_MAX_MUTEX) { |