diff options
-rw-r--r-- | drivers/acpi/dispatcher/dsmethod.c | 52 | ||||
-rw-r--r-- | drivers/acpi/parser/psparse.c | 21 | ||||
-rw-r--r-- | drivers/acpi/parser/psxface.c | 13 | ||||
-rw-r--r-- | drivers/acpi/utilities/utmisc.c | 2 | ||||
-rw-r--r-- | include/acpi/acdispat.h | 2 |
5 files changed, 35 insertions, 55 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 77fcfc3070db..8b67a918341e 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -235,6 +235,16 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
235 | acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, | 235 | acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, |
236 | ACPI_WAIT_FOREVER); | 236 | ACPI_WAIT_FOREVER); |
237 | } | 237 | } |
238 | /* | ||
239 | * allocate owner id for this method | ||
240 | */ | ||
241 | if (!obj_desc->method.thread_count) { | ||
242 | status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); | ||
243 | if (ACPI_FAILURE (status)) { | ||
244 | return_ACPI_STATUS (status); | ||
245 | } | ||
246 | } | ||
247 | |||
238 | 248 | ||
239 | /* | 249 | /* |
240 | * Increment the method parse tree thread count since it has been | 250 | * Increment the method parse tree thread count since it has been |
@@ -289,11 +299,6 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
289 | return_ACPI_STATUS(AE_NULL_OBJECT); | 299 | return_ACPI_STATUS(AE_NULL_OBJECT); |
290 | } | 300 | } |
291 | 301 | ||
292 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); | ||
293 | if (ACPI_FAILURE(status)) { | ||
294 | return_ACPI_STATUS(status); | ||
295 | } | ||
296 | |||
297 | /* Init for new method, wait on concurrency semaphore */ | 302 | /* Init for new method, wait on concurrency semaphore */ |
298 | 303 | ||
299 | status = acpi_ds_begin_method_execution(method_node, obj_desc, | 304 | status = acpi_ds_begin_method_execution(method_node, obj_desc, |
@@ -380,22 +385,18 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
380 | 385 | ||
381 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { | 386 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { |
382 | status = obj_desc->method.implementation(next_walk_state); | 387 | status = obj_desc->method.implementation(next_walk_state); |
383 | return_ACPI_STATUS(status); | ||
384 | } | 388 | } |
389 | goto end; | ||
385 | 390 | ||
386 | return_ACPI_STATUS(AE_OK); | 391 | cleanup: |
387 | 392 | /* Decrement the thread count on the method parse tree */ | |
388 | /* On error, we must delete the new walk state */ | ||
389 | |||
390 | cleanup: | ||
391 | acpi_ut_release_owner_id(&obj_desc->method.owner_id); | ||
392 | if (next_walk_state && (next_walk_state->method_desc)) { | 393 | if (next_walk_state && (next_walk_state->method_desc)) { |
393 | /* Decrement the thread count on the method parse tree */ | ||
394 | |||
395 | next_walk_state->method_desc->method.thread_count--; | 394 | next_walk_state->method_desc->method.thread_count--; |
396 | } | 395 | } |
397 | (void)acpi_ds_terminate_control_method(next_walk_state); | 396 | /* On error, we must delete the new walk state */ |
398 | acpi_ds_delete_walk_state(next_walk_state); | 397 | acpi_ds_terminate_control_method (next_walk_state); |
398 | acpi_ds_delete_walk_state (next_walk_state); | ||
399 | end: | ||
399 | return_ACPI_STATUS(status); | 400 | return_ACPI_STATUS(status); |
400 | } | 401 | } |
401 | 402 | ||
@@ -479,7 +480,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
479 | * | 480 | * |
480 | * PARAMETERS: walk_state - State of the method | 481 | * PARAMETERS: walk_state - State of the method |
481 | * | 482 | * |
482 | * RETURN: Status | 483 | * RETURN: None |
483 | * | 484 | * |
484 | * DESCRIPTION: Terminate a control method. Delete everything that the method | 485 | * DESCRIPTION: Terminate a control method. Delete everything that the method |
485 | * created, delete all locals and arguments, and delete the parse | 486 | * created, delete all locals and arguments, and delete the parse |
@@ -487,7 +488,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
487 | * | 488 | * |
488 | ******************************************************************************/ | 489 | ******************************************************************************/ |
489 | 490 | ||
490 | acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | 491 | void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) |
491 | { | 492 | { |
492 | union acpi_operand_object *obj_desc; | 493 | union acpi_operand_object *obj_desc; |
493 | struct acpi_namespace_node *method_node; | 494 | struct acpi_namespace_node *method_node; |
@@ -496,14 +497,14 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
496 | ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); | 497 | ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); |
497 | 498 | ||
498 | if (!walk_state) { | 499 | if (!walk_state) { |
499 | return (AE_BAD_PARAMETER); | 500 | return_VOID; |
500 | } | 501 | } |
501 | 502 | ||
502 | /* The current method object was saved in the walk state */ | 503 | /* The current method object was saved in the walk state */ |
503 | 504 | ||
504 | obj_desc = walk_state->method_desc; | 505 | obj_desc = walk_state->method_desc; |
505 | if (!obj_desc) { | 506 | if (!obj_desc) { |
506 | return_ACPI_STATUS(AE_OK); | 507 | return_VOID; |
507 | } | 508 | } |
508 | 509 | ||
509 | /* Delete all arguments and locals */ | 510 | /* Delete all arguments and locals */ |
@@ -517,7 +518,7 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
517 | */ | 518 | */ |
518 | status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); | 519 | status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); |
519 | if (ACPI_FAILURE(status)) { | 520 | if (ACPI_FAILURE(status)) { |
520 | return_ACPI_STATUS(status); | 521 | return_VOID; |
521 | } | 522 | } |
522 | 523 | ||
523 | /* Signal completion of the execution of this method if necessary */ | 524 | /* Signal completion of the execution of this method if necessary */ |
@@ -574,7 +575,7 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
574 | */ | 575 | */ |
575 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 576 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
576 | if (ACPI_FAILURE(status)) { | 577 | if (ACPI_FAILURE(status)) { |
577 | return_ACPI_STATUS(status); | 578 | goto cleanup; |
578 | } | 579 | } |
579 | 580 | ||
580 | if (method_node->child) { | 581 | if (method_node->child) { |
@@ -592,10 +593,9 @@ acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
592 | owner_id); | 593 | owner_id); |
593 | 594 | ||
594 | if (ACPI_FAILURE(status)) { | 595 | if (ACPI_FAILURE(status)) { |
595 | return_ACPI_STATUS(status); | 596 | goto cleanup; |
596 | } | 597 | } |
597 | } | 598 | } |
598 | 599 | cleanup: | |
599 | status = acpi_ut_release_mutex(ACPI_MTX_PARSER); | 600 | acpi_ut_release_mutex (ACPI_MTX_PARSER); |
600 | return_ACPI_STATUS(status); | ||
601 | } | 601 | } |
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 3248051d77ee..36771309c62f 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c | |||
@@ -438,7 +438,6 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | |||
438 | acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | 438 | acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) |
439 | { | 439 | { |
440 | acpi_status status; | 440 | acpi_status status; |
441 | acpi_status terminate_status; | ||
442 | struct acpi_thread_state *thread; | 441 | struct acpi_thread_state *thread; |
443 | struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; | 442 | struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; |
444 | struct acpi_walk_state *previous_walk_state; | 443 | struct acpi_walk_state *previous_walk_state; |
@@ -508,6 +507,9 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
508 | walk_state->method_node, NULL, | 507 | walk_state->method_node, NULL, |
509 | status); | 508 | status); |
510 | 509 | ||
510 | /* Make sure that failed method will be cleaned as if it was executed */ | ||
511 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE; | ||
512 | |||
511 | /* Check for possible multi-thread reentrancy problem */ | 513 | /* Check for possible multi-thread reentrancy problem */ |
512 | 514 | ||
513 | if ((status == AE_ALREADY_EXISTS) && | 515 | if ((status == AE_ALREADY_EXISTS) && |
@@ -524,14 +526,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
524 | } | 526 | } |
525 | } | 527 | } |
526 | 528 | ||
527 | if (walk_state->method_desc) { | ||
528 | /* Decrement the thread count on the method parse tree */ | ||
529 | |||
530 | if (walk_state->method_desc->method.thread_count) { | ||
531 | walk_state->method_desc->method.thread_count--; | ||
532 | } | ||
533 | } | ||
534 | |||
535 | /* We are done with this walk, move on to the parent if any */ | 529 | /* We are done with this walk, move on to the parent if any */ |
536 | 530 | ||
537 | walk_state = acpi_ds_pop_walk_state(thread); | 531 | walk_state = acpi_ds_pop_walk_state(thread); |
@@ -546,13 +540,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
546 | */ | 540 | */ |
547 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == | 541 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == |
548 | ACPI_PARSE_EXECUTE) { | 542 | ACPI_PARSE_EXECUTE) { |
549 | terminate_status = | 543 | if (walk_state->method_desc) { |
550 | acpi_ds_terminate_control_method(walk_state); | 544 | walk_state->method_desc->method.thread_count--; |
551 | if (ACPI_FAILURE(terminate_status)) { | ||
552 | ACPI_REPORT_ERROR(("Could not terminate control method properly\n")); | ||
553 | |||
554 | /* Ignore error and continue */ | ||
555 | } | 545 | } |
546 | acpi_ds_terminate_control_method (walk_state); | ||
556 | } | 547 | } |
557 | 548 | ||
558 | /* Delete this walk state and all linked control states */ | 549 | /* Delete this walk state and all linked control states */ |
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 80c67f2d3dd2..f6904bdf5739 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c | |||
@@ -99,16 +99,6 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | /* | 101 | /* |
102 | * Get a new owner_id for objects created by this method. Namespace | ||
103 | * objects (such as Operation Regions) can be created during the | ||
104 | * first pass parse. | ||
105 | */ | ||
106 | status = acpi_ut_allocate_owner_id(&info->obj_desc->method.owner_id); | ||
107 | if (ACPI_FAILURE(status)) { | ||
108 | return_ACPI_STATUS(status); | ||
109 | } | ||
110 | |||
111 | /* | ||
112 | * The caller "owns" the parameters, so give each one an extra | 102 | * The caller "owns" the parameters, so give each one an extra |
113 | * reference | 103 | * reference |
114 | */ | 104 | */ |
@@ -139,9 +129,6 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
139 | status = acpi_ps_execute_pass(info); | 129 | status = acpi_ps_execute_pass(info); |
140 | 130 | ||
141 | cleanup: | 131 | cleanup: |
142 | if (info->obj_desc->method.owner_id) { | ||
143 | acpi_ut_release_owner_id(&info->obj_desc->method.owner_id); | ||
144 | } | ||
145 | 132 | ||
146 | /* Take away the extra reference that we gave the parameters above */ | 133 | /* Take away the extra reference that we gave the parameters above */ |
147 | 134 | ||
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index f0275025b718..c2f5b2adb5d6 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -67,6 +67,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
67 | 67 | ||
68 | ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); | 68 | ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); |
69 | 69 | ||
70 | WARN_ON(*owner_id); | ||
71 | |||
70 | /* Mutex for the global ID mask */ | 72 | /* Mutex for the global ID mask */ |
71 | 73 | ||
72 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); | 74 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); |
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index 59306186f5e2..c436e8be6ba8 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h | |||
@@ -194,7 +194,7 @@ acpi_status | |||
194 | acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | 194 | acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, |
195 | union acpi_operand_object *return_desc); | 195 | union acpi_operand_object *return_desc); |
196 | 196 | ||
197 | acpi_status | 197 | void |
198 | acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state); | 198 | acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state); |
199 | 199 | ||
200 | acpi_status | 200 | acpi_status |