aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dispatcher/dsmethod.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/dispatcher/dsmethod.c')
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c52
1 files changed, 26 insertions, 26 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); 391cleanup:
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);
399end:
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
490acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) 491void 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 599cleanup:
599 status = acpi_ut_release_mutex(ACPI_MTX_PARSER); 600 acpi_ut_release_mutex (ACPI_MTX_PARSER);
600 return_ACPI_STATUS(status);
601} 601}