aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utmutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities/utmutex.c')
-rw-r--r--drivers/acpi/utilities/utmutex.c58
1 files changed, 26 insertions, 32 deletions
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
index 90134c56ece9..45a7244df924 100644
--- a/drivers/acpi/utilities/utmutex.c
+++ b/drivers/acpi/utilities/utmutex.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
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
@@ -214,23 +214,22 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
214 * the ACPI subsystem code. 214 * the ACPI subsystem code.
215 */ 215 */
216 for (i = mutex_id; i < MAX_MUTEX; i++) { 216 for (i = mutex_id; i < MAX_MUTEX; i++) {
217 if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { 217 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
218 if (i == mutex_id) { 218 if (i == mutex_id) {
219 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 219 ACPI_ERROR((AE_INFO,
220 "Mutex [%s] already acquired by this thread [%X]\n", 220 "Mutex [%s] already acquired by this thread [%X]",
221 acpi_ut_get_mutex_name 221 acpi_ut_get_mutex_name
222 (mutex_id), 222 (mutex_id),
223 this_thread_id)); 223 this_thread_id));
224 224
225 return (AE_ALREADY_ACQUIRED); 225 return (AE_ALREADY_ACQUIRED);
226 } 226 }
227 227
228 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 228 ACPI_ERROR((AE_INFO,
229 "Invalid acquire order: Thread %X owns [%s], wants [%s]\n", 229 "Invalid acquire order: Thread %X owns [%s], wants [%s]",
230 this_thread_id, 230 this_thread_id,
231 acpi_ut_get_mutex_name(i), 231 acpi_ut_get_mutex_name(i),
232 acpi_ut_get_mutex_name 232 acpi_ut_get_mutex_name(mutex_id)));
233 (mutex_id)));
234 233
235 return (AE_ACQUIRE_DEADLOCK); 234 return (AE_ACQUIRE_DEADLOCK);
236 } 235 }
@@ -253,11 +252,9 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
253 acpi_gbl_mutex_info[mutex_id].use_count++; 252 acpi_gbl_mutex_info[mutex_id].use_count++;
254 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; 253 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id;
255 } else { 254 } else {
256 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 255 ACPI_EXCEPTION((AE_INFO, status,
257 "Thread %X could not acquire Mutex [%s] %s\n", 256 "Thread %X could not acquire Mutex [%X]",
258 this_thread_id, 257 this_thread_id, mutex_id));
259 acpi_ut_get_mutex_name(mutex_id),
260 acpi_format_exception(status)));
261 } 258 }
262 259
263 return (status); 260 return (status);
@@ -295,9 +292,9 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
295 * Mutex must be acquired in order to release it! 292 * Mutex must be acquired in order to release it!
296 */ 293 */
297 if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) { 294 if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) {
298 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 295 ACPI_ERROR((AE_INFO,
299 "Mutex [%s] is not acquired, cannot release\n", 296 "Mutex [%X] is not acquired, cannot release",
300 acpi_ut_get_mutex_name(mutex_id))); 297 mutex_id));
301 298
302 return (AE_NOT_ACQUIRED); 299 return (AE_NOT_ACQUIRED);
303 } 300 }
@@ -313,16 +310,15 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
313 * the ACPI subsystem code. 310 * the ACPI subsystem code.
314 */ 311 */
315 for (i = mutex_id; i < MAX_MUTEX; i++) { 312 for (i = mutex_id; i < MAX_MUTEX; i++) {
316 if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { 313 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
317 if (i == mutex_id) { 314 if (i == mutex_id) {
318 continue; 315 continue;
319 } 316 }
320 317
321 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 318 ACPI_ERROR((AE_INFO,
322 "Invalid release order: owns [%s], releasing [%s]\n", 319 "Invalid release order: owns [%s], releasing [%s]",
323 acpi_ut_get_mutex_name(i), 320 acpi_ut_get_mutex_name(i),
324 acpi_ut_get_mutex_name 321 acpi_ut_get_mutex_name(mutex_id)));
325 (mutex_id)));
326 322
327 return (AE_RELEASE_DEADLOCK); 323 return (AE_RELEASE_DEADLOCK);
328 } 324 }
@@ -338,11 +334,9 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
338 acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1); 334 acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1);
339 335
340 if (ACPI_FAILURE(status)) { 336 if (ACPI_FAILURE(status)) {
341 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 337 ACPI_EXCEPTION((AE_INFO, status,
342 "Thread %X could not release Mutex [%s] %s\n", 338 "Thread %X could not release Mutex [%X]",
343 this_thread_id, 339 this_thread_id, mutex_id));
344 acpi_ut_get_mutex_name(mutex_id),
345 acpi_format_exception(status)));
346 } else { 340 } else {
347 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, 341 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
348 "Thread %X released Mutex [%s]\n", 342 "Thread %X released Mutex [%s]\n",