diff options
Diffstat (limited to 'drivers/acpi/acpica/exmutex.c')
-rw-r--r-- | drivers/acpi/acpica/exmutex.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c index 7116bc86494d..f73be97043c0 100644 --- a/drivers/acpi/acpica/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c | |||
@@ -85,10 +85,10 @@ void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc) | |||
85 | (obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next; | 85 | (obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next; |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * Migrate the previous sync level associated with this mutex to the | 88 | * Migrate the previous sync level associated with this mutex to |
89 | * previous mutex on the list so that it may be preserved. This handles | 89 | * the previous mutex on the list so that it may be preserved. |
90 | * the case where several mutexes have been acquired at the same level, | 90 | * This handles the case where several mutexes have been acquired |
91 | * but are not released in opposite order. | 91 | * at the same level, but are not released in opposite order. |
92 | */ | 92 | */ |
93 | (obj_desc->mutex.prev)->mutex.original_sync_level = | 93 | (obj_desc->mutex.prev)->mutex.original_sync_level = |
94 | obj_desc->mutex.original_sync_level; | 94 | obj_desc->mutex.original_sync_level; |
@@ -101,8 +101,8 @@ void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc) | |||
101 | * | 101 | * |
102 | * FUNCTION: acpi_ex_link_mutex | 102 | * FUNCTION: acpi_ex_link_mutex |
103 | * | 103 | * |
104 | * PARAMETERS: obj_desc - The mutex to be linked | 104 | * PARAMETERS: obj_desc - The mutex to be linked |
105 | * Thread - Current executing thread object | 105 | * Thread - Current executing thread object |
106 | * | 106 | * |
107 | * RETURN: None | 107 | * RETURN: None |
108 | * | 108 | * |
@@ -138,9 +138,9 @@ acpi_ex_link_mutex(union acpi_operand_object *obj_desc, | |||
138 | * | 138 | * |
139 | * FUNCTION: acpi_ex_acquire_mutex_object | 139 | * FUNCTION: acpi_ex_acquire_mutex_object |
140 | * | 140 | * |
141 | * PARAMETERS: time_desc - Timeout in milliseconds | 141 | * PARAMETERS: Timeout - Timeout in milliseconds |
142 | * obj_desc - Mutex object | 142 | * obj_desc - Mutex object |
143 | * Thread - Current thread state | 143 | * thread_id - Current thread state |
144 | * | 144 | * |
145 | * RETURN: Status | 145 | * RETURN: Status |
146 | * | 146 | * |
@@ -234,7 +234,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
234 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 234 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
235 | } | 235 | } |
236 | 236 | ||
237 | /* Must have a valid thread ID */ | 237 | /* Must have a valid thread state struct */ |
238 | 238 | ||
239 | if (!walk_state->thread) { | 239 | if (!walk_state->thread) { |
240 | ACPI_ERROR((AE_INFO, | 240 | ACPI_ERROR((AE_INFO, |
@@ -249,7 +249,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
249 | */ | 249 | */ |
250 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { | 250 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { |
251 | ACPI_ERROR((AE_INFO, | 251 | ACPI_ERROR((AE_INFO, |
252 | "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%d)", | 252 | "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%u)", |
253 | acpi_ut_get_node_name(obj_desc->mutex.node), | 253 | acpi_ut_get_node_name(obj_desc->mutex.node), |
254 | walk_state->thread->current_sync_level)); | 254 | walk_state->thread->current_sync_level)); |
255 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); | 255 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
@@ -359,6 +359,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
359 | { | 359 | { |
360 | acpi_status status = AE_OK; | 360 | acpi_status status = AE_OK; |
361 | u8 previous_sync_level; | 361 | u8 previous_sync_level; |
362 | struct acpi_thread_state *owner_thread; | ||
362 | 363 | ||
363 | ACPI_FUNCTION_TRACE(ex_release_mutex); | 364 | ACPI_FUNCTION_TRACE(ex_release_mutex); |
364 | 365 | ||
@@ -366,9 +367,11 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
366 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 367 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
367 | } | 368 | } |
368 | 369 | ||
370 | owner_thread = obj_desc->mutex.owner_thread; | ||
371 | |||
369 | /* The mutex must have been previously acquired in order to release it */ | 372 | /* The mutex must have been previously acquired in order to release it */ |
370 | 373 | ||
371 | if (!obj_desc->mutex.owner_thread) { | 374 | if (!owner_thread) { |
372 | ACPI_ERROR((AE_INFO, | 375 | ACPI_ERROR((AE_INFO, |
373 | "Cannot release Mutex [%4.4s], not acquired", | 376 | "Cannot release Mutex [%4.4s], not acquired", |
374 | acpi_ut_get_node_name(obj_desc->mutex.node))); | 377 | acpi_ut_get_node_name(obj_desc->mutex.node))); |
@@ -387,16 +390,13 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
387 | * The Mutex is owned, but this thread must be the owner. | 390 | * The Mutex is owned, but this thread must be the owner. |
388 | * Special case for Global Lock, any thread can release | 391 | * Special case for Global Lock, any thread can release |
389 | */ | 392 | */ |
390 | if ((obj_desc->mutex.owner_thread->thread_id != | 393 | if ((owner_thread->thread_id != walk_state->thread->thread_id) && |
391 | walk_state->thread->thread_id) | 394 | (obj_desc != acpi_gbl_global_lock_mutex)) { |
392 | && (obj_desc != acpi_gbl_global_lock_mutex)) { | ||
393 | ACPI_ERROR((AE_INFO, | 395 | ACPI_ERROR((AE_INFO, |
394 | "Thread %p cannot release Mutex [%4.4s] acquired by thread %p", | 396 | "Thread %p cannot release Mutex [%4.4s] acquired by thread %p", |
395 | ACPI_CAST_PTR(void, walk_state->thread->thread_id), | 397 | ACPI_CAST_PTR(void, walk_state->thread->thread_id), |
396 | acpi_ut_get_node_name(obj_desc->mutex.node), | 398 | acpi_ut_get_node_name(obj_desc->mutex.node), |
397 | ACPI_CAST_PTR(void, | 399 | ACPI_CAST_PTR(void, owner_thread->thread_id))); |
398 | obj_desc->mutex.owner_thread-> | ||
399 | thread_id))); | ||
400 | return_ACPI_STATUS(AE_AML_NOT_OWNER); | 400 | return_ACPI_STATUS(AE_AML_NOT_OWNER); |
401 | } | 401 | } |
402 | 402 | ||
@@ -407,10 +407,9 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
407 | * different level can only mean that the mutex ordering rule is being | 407 | * different level can only mean that the mutex ordering rule is being |
408 | * violated. This behavior is clarified in ACPI 4.0 specification. | 408 | * violated. This behavior is clarified in ACPI 4.0 specification. |
409 | */ | 409 | */ |
410 | if (obj_desc->mutex.sync_level != | 410 | if (obj_desc->mutex.sync_level != owner_thread->current_sync_level) { |
411 | walk_state->thread->current_sync_level) { | ||
412 | ACPI_ERROR((AE_INFO, | 411 | ACPI_ERROR((AE_INFO, |
413 | "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", | 412 | "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %u current %u", |
414 | acpi_ut_get_node_name(obj_desc->mutex.node), | 413 | acpi_ut_get_node_name(obj_desc->mutex.node), |
415 | obj_desc->mutex.sync_level, | 414 | obj_desc->mutex.sync_level, |
416 | walk_state->thread->current_sync_level)); | 415 | walk_state->thread->current_sync_level)); |
@@ -423,7 +422,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
423 | * acquired, but are not released in reverse order. | 422 | * acquired, but are not released in reverse order. |
424 | */ | 423 | */ |
425 | previous_sync_level = | 424 | previous_sync_level = |
426 | walk_state->thread->acquired_mutex_list->mutex.original_sync_level; | 425 | owner_thread->acquired_mutex_list->mutex.original_sync_level; |
427 | 426 | ||
428 | status = acpi_ex_release_mutex_object(obj_desc); | 427 | status = acpi_ex_release_mutex_object(obj_desc); |
429 | if (ACPI_FAILURE(status)) { | 428 | if (ACPI_FAILURE(status)) { |
@@ -434,8 +433,9 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
434 | 433 | ||
435 | /* Restore the previous sync_level */ | 434 | /* Restore the previous sync_level */ |
436 | 435 | ||
437 | walk_state->thread->current_sync_level = previous_sync_level; | 436 | owner_thread->current_sync_level = previous_sync_level; |
438 | } | 437 | } |
438 | |||
439 | return_ACPI_STATUS(status); | 439 | return_ACPI_STATUS(status); |
440 | } | 440 | } |
441 | 441 | ||
@@ -443,7 +443,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
443 | * | 443 | * |
444 | * FUNCTION: acpi_ex_release_all_mutexes | 444 | * FUNCTION: acpi_ex_release_all_mutexes |
445 | * | 445 | * |
446 | * PARAMETERS: Thread - Current executing thread object | 446 | * PARAMETERS: Thread - Current executing thread object |
447 | * | 447 | * |
448 | * RETURN: Status | 448 | * RETURN: Status |
449 | * | 449 | * |