diff options
Diffstat (limited to 'drivers/acpi/dispatcher/dsmethod.c')
-rw-r--r-- | drivers/acpi/dispatcher/dsmethod.c | 57 |
1 files changed, 23 insertions, 34 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 1cbe61905824..e48a3ea03117 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -42,7 +42,6 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | ||
46 | #include <acpi/amlcode.h> | 45 | #include <acpi/amlcode.h> |
47 | #include <acpi/acdispat.h> | 46 | #include <acpi/acdispat.h> |
48 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
@@ -102,7 +101,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | |||
102 | walk_state->opcode, | 101 | walk_state->opcode, |
103 | walk_state->aml_offset, | 102 | walk_state->aml_offset, |
104 | NULL); | 103 | NULL); |
105 | (void)acpi_ex_enter_interpreter(); | 104 | acpi_ex_enter_interpreter(); |
106 | } | 105 | } |
107 | #ifdef ACPI_DISASSEMBLER | 106 | #ifdef ACPI_DISASSEMBLER |
108 | if (ACPI_FAILURE(status)) { | 107 | if (ACPI_FAILURE(status)) { |
@@ -232,9 +231,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
232 | * recursive call. | 231 | * recursive call. |
233 | */ | 232 | */ |
234 | if (!walk_state || | 233 | if (!walk_state || |
235 | !obj_desc->method.mutex->mutex.owner_thread || | 234 | !obj_desc->method.mutex->mutex.thread_id || |
236 | (walk_state->thread != | 235 | (walk_state->thread->thread_id != |
237 | obj_desc->method.mutex->mutex.owner_thread)) { | 236 | obj_desc->method.mutex->mutex.thread_id)) { |
238 | /* | 237 | /* |
239 | * Acquire the method mutex. This releases the interpreter if we | 238 | * Acquire the method mutex. This releases the interpreter if we |
240 | * block (and reacquires it before it returns) | 239 | * block (and reacquires it before it returns) |
@@ -254,8 +253,8 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
254 | original_sync_level = | 253 | original_sync_level = |
255 | walk_state->thread->current_sync_level; | 254 | walk_state->thread->current_sync_level; |
256 | 255 | ||
257 | obj_desc->method.mutex->mutex.owner_thread = | 256 | obj_desc->method.mutex->mutex.thread_id = |
258 | walk_state->thread; | 257 | walk_state->thread->thread_id; |
259 | walk_state->thread->current_sync_level = | 258 | walk_state->thread->current_sync_level = |
260 | obj_desc->method.sync_level; | 259 | obj_desc->method.sync_level; |
261 | } else { | 260 | } else { |
@@ -535,8 +534,6 @@ void | |||
535 | acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | 534 | acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, |
536 | struct acpi_walk_state *walk_state) | 535 | struct acpi_walk_state *walk_state) |
537 | { | 536 | { |
538 | struct acpi_namespace_node *method_node; | ||
539 | acpi_status status; | ||
540 | 537 | ||
541 | ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state); | 538 | ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state); |
542 | 539 | ||
@@ -551,34 +548,26 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
551 | /* Delete all arguments and locals */ | 548 | /* Delete all arguments and locals */ |
552 | 549 | ||
553 | acpi_ds_method_data_delete_all(walk_state); | 550 | acpi_ds_method_data_delete_all(walk_state); |
554 | } | ||
555 | 551 | ||
556 | /* | 552 | /* |
557 | * If method is serialized, release the mutex and restore the | 553 | * If method is serialized, release the mutex and restore the |
558 | * current sync level for this thread | 554 | * current sync level for this thread |
559 | */ | 555 | */ |
560 | if (method_desc->method.mutex) { | 556 | if (method_desc->method.mutex) { |
561 | 557 | ||
562 | /* Acquisition Depth handles recursive calls */ | 558 | /* Acquisition Depth handles recursive calls */ |
563 | 559 | ||
564 | method_desc->method.mutex->mutex.acquisition_depth--; | 560 | method_desc->method.mutex->mutex.acquisition_depth--; |
565 | if (!method_desc->method.mutex->mutex.acquisition_depth) { | 561 | if (!method_desc->method.mutex->mutex.acquisition_depth) { |
566 | walk_state->thread->current_sync_level = | 562 | walk_state->thread->current_sync_level = |
567 | method_desc->method.mutex->mutex. | 563 | method_desc->method.mutex->mutex. |
568 | original_sync_level; | 564 | original_sync_level; |
569 | 565 | ||
570 | acpi_os_release_mutex(method_desc->method.mutex->mutex. | 566 | acpi_os_release_mutex(method_desc->method. |
571 | os_mutex); | 567 | mutex->mutex.os_mutex); |
572 | method_desc->method.mutex->mutex.owner_thread = NULL; | 568 | method_desc->method.mutex->mutex.thread_id = 0; |
569 | } | ||
573 | } | 570 | } |
574 | } | ||
575 | |||
576 | if (walk_state) { | ||
577 | /* | ||
578 | * Delete any objects created by this method during execution. | ||
579 | * The method Node is stored in the walk state | ||
580 | */ | ||
581 | method_node = walk_state->method_node; | ||
582 | 571 | ||
583 | /* | 572 | /* |
584 | * Delete any namespace objects created anywhere within | 573 | * Delete any namespace objects created anywhere within |
@@ -620,7 +609,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
620 | */ | 609 | */ |
621 | if ((method_desc->method.method_flags & AML_METHOD_SERIALIZED) | 610 | if ((method_desc->method.method_flags & AML_METHOD_SERIALIZED) |
622 | && (!method_desc->method.mutex)) { | 611 | && (!method_desc->method.mutex)) { |
623 | status = acpi_ds_create_method_mutex(method_desc); | 612 | (void)acpi_ds_create_method_mutex(method_desc); |
624 | } | 613 | } |
625 | 614 | ||
626 | /* No more threads, we can free the owner_id */ | 615 | /* No more threads, we can free the owner_id */ |