diff options
Diffstat (limited to 'drivers/acpi/dispatcher/dsmethod.c')
-rw-r--r-- | drivers/acpi/dispatcher/dsmethod.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 8b67a918341e..77fcfc3070db 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -235,16 +235,6 @@ 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 | |||
248 | 238 | ||
249 | /* | 239 | /* |
250 | * Increment the method parse tree thread count since it has been | 240 | * Increment the method parse tree thread count since it has been |
@@ -299,6 +289,11 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
299 | return_ACPI_STATUS(AE_NULL_OBJECT); | 289 | return_ACPI_STATUS(AE_NULL_OBJECT); |
300 | } | 290 | } |
301 | 291 | ||
292 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); | ||
293 | if (ACPI_FAILURE(status)) { | ||
294 | return_ACPI_STATUS(status); | ||
295 | } | ||
296 | |||
302 | /* Init for new method, wait on concurrency semaphore */ | 297 | /* Init for new method, wait on concurrency semaphore */ |
303 | 298 | ||
304 | status = acpi_ds_begin_method_execution(method_node, obj_desc, | 299 | status = acpi_ds_begin_method_execution(method_node, obj_desc, |
@@ -385,18 +380,22 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
385 | 380 | ||
386 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { | 381 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { |
387 | status = obj_desc->method.implementation(next_walk_state); | 382 | status = obj_desc->method.implementation(next_walk_state); |
383 | return_ACPI_STATUS(status); | ||
388 | } | 384 | } |
389 | goto end; | ||
390 | 385 | ||
391 | cleanup: | 386 | return_ACPI_STATUS(AE_OK); |
392 | /* Decrement the thread count on the method parse tree */ | 387 | |
388 | /* On error, we must delete the new walk state */ | ||
389 | |||
390 | cleanup: | ||
391 | acpi_ut_release_owner_id(&obj_desc->method.owner_id); | ||
393 | if (next_walk_state && (next_walk_state->method_desc)) { | 392 | if (next_walk_state && (next_walk_state->method_desc)) { |
393 | /* Decrement the thread count on the method parse tree */ | ||
394 | |||
394 | next_walk_state->method_desc->method.thread_count--; | 395 | next_walk_state->method_desc->method.thread_count--; |
395 | } | 396 | } |
396 | /* On error, we must delete the new walk state */ | 397 | (void)acpi_ds_terminate_control_method(next_walk_state); |
397 | acpi_ds_terminate_control_method (next_walk_state); | 398 | acpi_ds_delete_walk_state(next_walk_state); |
398 | acpi_ds_delete_walk_state (next_walk_state); | ||
399 | end: | ||
400 | return_ACPI_STATUS(status); | 399 | return_ACPI_STATUS(status); |
401 | } | 400 | } |
402 | 401 | ||
@@ -480,7 +479,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
480 | * | 479 | * |
481 | * PARAMETERS: walk_state - State of the method | 480 | * PARAMETERS: walk_state - State of the method |
482 | * | 481 | * |
483 | * RETURN: None | 482 | * RETURN: Status |
484 | * | 483 | * |
485 | * DESCRIPTION: Terminate a control method. Delete everything that the method | 484 | * DESCRIPTION: Terminate a control method. Delete everything that the method |
486 | * created, delete all locals and arguments, and delete the parse | 485 | * created, delete all locals and arguments, and delete the parse |
@@ -488,7 +487,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
488 | * | 487 | * |
489 | ******************************************************************************/ | 488 | ******************************************************************************/ |
490 | 489 | ||
491 | void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | 490 | acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) |
492 | { | 491 | { |
493 | union acpi_operand_object *obj_desc; | 492 | union acpi_operand_object *obj_desc; |
494 | struct acpi_namespace_node *method_node; | 493 | struct acpi_namespace_node *method_node; |
@@ -497,14 +496,14 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
497 | ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); | 496 | ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); |
498 | 497 | ||
499 | if (!walk_state) { | 498 | if (!walk_state) { |
500 | return_VOID; | 499 | return (AE_BAD_PARAMETER); |
501 | } | 500 | } |
502 | 501 | ||
503 | /* The current method object was saved in the walk state */ | 502 | /* The current method object was saved in the walk state */ |
504 | 503 | ||
505 | obj_desc = walk_state->method_desc; | 504 | obj_desc = walk_state->method_desc; |
506 | if (!obj_desc) { | 505 | if (!obj_desc) { |
507 | return_VOID; | 506 | return_ACPI_STATUS(AE_OK); |
508 | } | 507 | } |
509 | 508 | ||
510 | /* Delete all arguments and locals */ | 509 | /* Delete all arguments and locals */ |
@@ -518,7 +517,7 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
518 | */ | 517 | */ |
519 | status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); | 518 | status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); |
520 | if (ACPI_FAILURE(status)) { | 519 | if (ACPI_FAILURE(status)) { |
521 | return_VOID; | 520 | return_ACPI_STATUS(status); |
522 | } | 521 | } |
523 | 522 | ||
524 | /* Signal completion of the execution of this method if necessary */ | 523 | /* Signal completion of the execution of this method if necessary */ |
@@ -575,7 +574,7 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
575 | */ | 574 | */ |
576 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 575 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
577 | if (ACPI_FAILURE(status)) { | 576 | if (ACPI_FAILURE(status)) { |
578 | goto cleanup; | 577 | return_ACPI_STATUS(status); |
579 | } | 578 | } |
580 | 579 | ||
581 | if (method_node->child) { | 580 | if (method_node->child) { |
@@ -593,9 +592,10 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
593 | owner_id); | 592 | owner_id); |
594 | 593 | ||
595 | if (ACPI_FAILURE(status)) { | 594 | if (ACPI_FAILURE(status)) { |
596 | goto cleanup; | 595 | return_ACPI_STATUS(status); |
597 | } | 596 | } |
598 | } | 597 | } |
599 | cleanup: | 598 | |
600 | acpi_ut_release_mutex (ACPI_MTX_PARSER); | 599 | status = acpi_ut_release_mutex(ACPI_MTX_PARSER); |
600 | return_ACPI_STATUS(status); | ||
601 | } | 601 | } |