diff options
Diffstat (limited to 'drivers/acpi/dispatcher/dsmethod.c')
-rw-r--r-- | drivers/acpi/dispatcher/dsmethod.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 1b90813cbde1..e344c06ed33f 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -58,12 +58,11 @@ | |||
58 | * | 58 | * |
59 | * FUNCTION: acpi_ds_parse_method | 59 | * FUNCTION: acpi_ds_parse_method |
60 | * | 60 | * |
61 | * PARAMETERS: obj_handle - Method node | 61 | * PARAMETERS: Node - Method node |
62 | * | 62 | * |
63 | * RETURN: Status | 63 | * RETURN: Status |
64 | * | 64 | * |
65 | * DESCRIPTION: Call the parser and parse the AML that is associated with the | 65 | * DESCRIPTION: Parse the AML that is associated with the method. |
66 | * method. | ||
67 | * | 66 | * |
68 | * MUTEX: Assumes parser is locked | 67 | * MUTEX: Assumes parser is locked |
69 | * | 68 | * |
@@ -71,30 +70,28 @@ | |||
71 | 70 | ||
72 | acpi_status | 71 | acpi_status |
73 | acpi_ds_parse_method ( | 72 | acpi_ds_parse_method ( |
74 | acpi_handle obj_handle) | 73 | struct acpi_namespace_node *node) |
75 | { | 74 | { |
76 | acpi_status status; | 75 | acpi_status status; |
77 | union acpi_operand_object *obj_desc; | 76 | union acpi_operand_object *obj_desc; |
78 | union acpi_parse_object *op; | 77 | union acpi_parse_object *op; |
79 | struct acpi_namespace_node *node; | ||
80 | struct acpi_walk_state *walk_state; | 78 | struct acpi_walk_state *walk_state; |
81 | 79 | ||
82 | 80 | ||
83 | ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", obj_handle); | 81 | ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", node); |
84 | 82 | ||
85 | 83 | ||
86 | /* Parameter Validation */ | 84 | /* Parameter Validation */ |
87 | 85 | ||
88 | if (!obj_handle) { | 86 | if (!node) { |
89 | return_ACPI_STATUS (AE_NULL_ENTRY); | 87 | return_ACPI_STATUS (AE_NULL_ENTRY); |
90 | } | 88 | } |
91 | 89 | ||
92 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n", | 90 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n", |
93 | acpi_ut_get_node_name (obj_handle), obj_handle)); | 91 | acpi_ut_get_node_name (node), node)); |
94 | 92 | ||
95 | /* Extract the method object from the method Node */ | 93 | /* Extract the method object from the method Node */ |
96 | 94 | ||
97 | node = (struct acpi_namespace_node *) obj_handle; | ||
98 | obj_desc = acpi_ns_get_attached_object (node); | 95 | obj_desc = acpi_ns_get_attached_object (node); |
99 | if (!obj_desc) { | 96 | if (!obj_desc) { |
100 | return_ACPI_STATUS (AE_NULL_OBJECT); | 97 | return_ACPI_STATUS (AE_NULL_OBJECT); |
@@ -169,10 +166,18 @@ acpi_ds_parse_method ( | |||
169 | 166 | ||
170 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, | 167 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, |
171 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", | 168 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", |
172 | acpi_ut_get_node_name (obj_handle), obj_handle, op)); | 169 | acpi_ut_get_node_name (node), node, op)); |
170 | |||
171 | /* | ||
172 | * Delete the parse tree. We simply re-parse the method for every | ||
173 | * execution since there isn't much overhead (compared to keeping lots | ||
174 | * of parse trees around) | ||
175 | */ | ||
176 | acpi_ns_delete_namespace_subtree (node); | ||
177 | acpi_ns_delete_namespace_by_owner (obj_desc->method.owner_id); | ||
173 | 178 | ||
174 | cleanup2: | 179 | cleanup2: |
175 | (void) acpi_ut_release_owner_id (obj_desc->method.owner_id); | 180 | acpi_ut_release_owner_id (&obj_desc->method.owner_id); |
176 | 181 | ||
177 | cleanup: | 182 | cleanup: |
178 | acpi_ps_delete_parse_tree (op); | 183 | acpi_ps_delete_parse_tree (op); |
@@ -391,7 +396,7 @@ acpi_ds_call_control_method ( | |||
391 | /* On error, we must delete the new walk state */ | 396 | /* On error, we must delete the new walk state */ |
392 | 397 | ||
393 | cleanup: | 398 | cleanup: |
394 | (void) acpi_ut_release_owner_id (obj_desc->method.owner_id); | 399 | acpi_ut_release_owner_id (&obj_desc->method.owner_id); |
395 | if (next_walk_state && (next_walk_state->method_desc)) { | 400 | if (next_walk_state && (next_walk_state->method_desc)) { |
396 | /* Decrement the thread count on the method parse tree */ | 401 | /* Decrement the thread count on the method parse tree */ |
397 | 402 | ||
@@ -563,8 +568,7 @@ acpi_ds_terminate_control_method ( | |||
563 | */ | 568 | */ |
564 | if ((walk_state->method_desc->method.concurrency == 1) && | 569 | if ((walk_state->method_desc->method.concurrency == 1) && |
565 | (!walk_state->method_desc->method.semaphore)) { | 570 | (!walk_state->method_desc->method.semaphore)) { |
566 | status = acpi_os_create_semaphore (1, | 571 | status = acpi_os_create_semaphore (1, 1, |
567 | 1, | ||
568 | &walk_state->method_desc->method.semaphore); | 572 | &walk_state->method_desc->method.semaphore); |
569 | } | 573 | } |
570 | 574 | ||
@@ -595,6 +599,8 @@ acpi_ds_terminate_control_method ( | |||
595 | */ | 599 | */ |
596 | acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id); | 600 | acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id); |
597 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 601 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); |
602 | acpi_ut_release_owner_id (&walk_state->method_desc->method.owner_id); | ||
603 | |||
598 | if (ACPI_FAILURE (status)) { | 604 | if (ACPI_FAILURE (status)) { |
599 | return_ACPI_STATUS (status); | 605 | return_ACPI_STATUS (status); |
600 | } | 606 | } |