linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / acpi / parser / psparse.c
index a02aa62..a9f3229 100644 (file)
@@ -106,7 +106,6 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)
        opcode = (u16) ACPI_GET8(aml);
 
        if (opcode == AML_EXTENDED_OP_PREFIX) {
-
                /* Extended opcode, get the second opcode byte */
 
                aml++;
@@ -138,7 +137,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
        const struct acpi_opcode_info *parent_info;
        union acpi_parse_object *replacement_op = NULL;
 
-       ACPI_FUNCTION_TRACE_PTR(ps_complete_this_op, op);
+       ACPI_FUNCTION_TRACE_PTR("ps_complete_this_op", op);
 
        /* Check for null Op, can happen if AML code is corrupt */
 
@@ -159,7 +158,6 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
        if (op->common.parent) {
                prev = op->common.parent->common.value.arg;
                if (!prev) {
-
                        /* Nothing more to do */
 
                        goto cleanup;
@@ -247,7 +245,6 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
                /* We must unlink this op from the parent tree */
 
                if (prev == op) {
-
                        /* This op is the first in the list */
 
                        if (replacement_op) {
@@ -268,7 +265,6 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
 
                else
                        while (prev) {
-
                                /* Traverse all siblings in the parent's argument list */
 
                                next = prev->common.next;
@@ -333,7 +329,7 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
        struct acpi_parse_state *parser_state = &walk_state->parser_state;
        acpi_status status = AE_CTRL_PENDING;
 
-       ACPI_FUNCTION_TRACE_PTR(ps_next_parse_state, op);
+       ACPI_FUNCTION_TRACE_PTR("ps_next_parse_state", op);
 
        switch (callback_status) {
        case AE_CTRL_TERMINATE:
@@ -453,10 +449,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
        struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list;
        struct acpi_walk_state *previous_walk_state;
 
-       ACPI_FUNCTION_TRACE(ps_parse_aml);
+       ACPI_FUNCTION_TRACE("ps_parse_aml");
 
        ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
-                         "Entered with WalkState=%p Aml=%p size=%X\n",
+                         "Entered with walk_state=%p Aml=%p size=%X\n",
                          walk_state, walk_state->parser_state.aml,
                          walk_state->parser_state.aml_size));
 
@@ -464,21 +460,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
 
        thread = acpi_ut_create_thread_state();
        if (!thread) {
-               acpi_ds_delete_walk_state(walk_state);
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        walk_state->thread = thread;
-
-       /*
-        * If executing a method, the starting sync_level is this method's
-        * sync_level
-        */
-       if (walk_state->method_desc) {
-               walk_state->thread->current_sync_level =
-                   walk_state->method_desc->method.sync_level;
-       }
-
        acpi_ds_push_walk_state(walk_state, thread);
 
        /*
@@ -515,10 +500,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
                        status =
                            acpi_ds_call_control_method(thread, walk_state,
                                                        NULL);
-                       if (ACPI_FAILURE(status)) {
-                               status =
-                                   acpi_ds_method_error(status, walk_state);
-                       }
 
                        /*
                         * If the transfer to the new method method call worked, a new walk
@@ -529,7 +510,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
                } else if (status == AE_CTRL_TERMINATE) {
                        status = AE_OK;
                } else if ((status != AE_OK) && (walk_state->method_desc)) {
-
                        /* Either the method parse or actual execution failed */
 
                        ACPI_ERROR_METHOD("Method parse/execution failed",
@@ -539,7 +519,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
                        /* Check for possible multi-thread reentrancy problem */
 
                        if ((status == AE_ALREADY_EXISTS) &&
-                           (!walk_state->method_desc->method.mutex)) {
+                           (!walk_state->method_desc->method.semaphore)) {
                                /*
                                 * Method tried to create an object twice. The probable cause is
                                 * that the method cannot handle reentrancy.
@@ -551,7 +531,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
                                 */
                                walk_state->method_desc->method.method_flags |=
                                    AML_METHOD_SERIALIZED;
-                               walk_state->method_desc->method.sync_level = 0;
+                               walk_state->method_desc->method.concurrency = 1;
                        }
                }
 
@@ -570,9 +550,20 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
                 */
                if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
                     ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) {
-                       acpi_ds_terminate_control_method(walk_state->
-                                                        method_desc,
-                                                        walk_state);
+                       if (walk_state->method_desc) {
+                               /* Decrement the thread count on the method parse tree */
+
+                               if (walk_state->method_desc->method.
+                                   thread_count) {
+                                       walk_state->method_desc->method.
+                                           thread_count--;
+                               } else {
+                                       ACPI_ERROR((AE_INFO,
+                                                   "Invalid zero thread count in method"));
+                               }
+                       }
+
+                       acpi_ds_terminate_control_method(walk_state);
                }
 
                /* Delete this walk state and all linked control states */
@@ -581,7 +572,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
                previous_walk_state = walk_state;
 
                ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
-                                 "ReturnValue=%p, ImplicitValue=%p State=%p\n",
+                                 "return_value=%p, implicit_value=%p State=%p\n",
                                  walk_state->return_desc,
                                  walk_state->implicit_return_obj, walk_state));
 
@@ -642,14 +633,12 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
                        }
                } else {
                        if (previous_walk_state->return_desc) {
-
                                /* Caller doesn't want it, must delete it */
 
                                acpi_ut_remove_reference(previous_walk_state->
                                                         return_desc);
                        }
                        if (previous_walk_state->implicit_return_obj) {
-
                                /* Caller doesn't want it, must delete it */
 
                                acpi_ut_remove_reference(previous_walk_state->