linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / acpi / executer / exoparg1.c
index 6374d8b..23d0823 100644 (file)
@@ -89,7 +89,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state)
        acpi_status status = AE_OK;
        union acpi_operand_object *return_desc = NULL;
 
-       ACPI_FUNCTION_TRACE_STR(ex_opcode_0A_0T_1R,
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R",
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
@@ -150,7 +150,7 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state)
        union acpi_operand_object **operand = &walk_state->operands[0];
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_0R,
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R",
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
@@ -216,7 +216,7 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state)
        acpi_status status = AE_OK;
        union acpi_operand_object **operand = &walk_state->operands[0];
 
-       ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_0R,
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R",
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
@@ -264,7 +264,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
        acpi_integer power_of_ten;
        acpi_integer digit;
 
-       ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R,
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R",
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
@@ -322,9 +322,8 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
 
                        /* Since the bit position is one-based, subtract from 33 (65) */
 
-                       return_desc->integer.value =
-                           temp32 ==
-                           0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
+                       return_desc->integer.value = temp32 == 0 ? 0 :
+                           (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
                        break;
 
                case AML_FROM_BCD_OP:   /* from_bcd (BCDValue, Result) */
@@ -343,7 +342,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
                        for (i = 0;
                             (i < acpi_gbl_integer_nybble_width) && (digit > 0);
                             i++) {
-
                                /* Get the least significant 4-bit BCD digit */
 
                                temp32 = ((u32) digit) & 0xF;
@@ -489,7 +487,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
                status = acpi_ex_convert_to_string(operand[0], &return_desc,
                                                   ACPI_EXPLICIT_CONVERT_DECIMAL);
                if (return_desc == operand[0]) {
-
                        /* No conversion performed, add ref to handle return value */
                        acpi_ut_add_reference(return_desc);
                }
@@ -500,7 +497,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
                status = acpi_ex_convert_to_string(operand[0], &return_desc,
                                                   ACPI_EXPLICIT_CONVERT_HEX);
                if (return_desc == operand[0]) {
-
                        /* No conversion performed, add ref to handle return value */
                        acpi_ut_add_reference(return_desc);
                }
@@ -510,7 +506,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
 
                status = acpi_ex_convert_to_buffer(operand[0], &return_desc);
                if (return_desc == operand[0]) {
-
                        /* No conversion performed, add ref to handle return value */
                        acpi_ut_add_reference(return_desc);
                }
@@ -521,7 +516,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
                status = acpi_ex_convert_to_integer(operand[0], &return_desc,
                                                    ACPI_ANY_BASE);
                if (return_desc == operand[0]) {
-
                        /* No conversion performed, add ref to handle return value */
                        acpi_ut_add_reference(return_desc);
                }
@@ -547,7 +541,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
        }
 
        if (ACPI_SUCCESS(status)) {
-
                /* Store the return value computed above into the target object */
 
                status = acpi_ex_store(return_desc, operand[1], walk_state);
@@ -555,18 +548,16 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
 
       cleanup:
 
+       if (!walk_state->result_obj) {
+               walk_state->result_obj = return_desc;
+       }
+
        /* Delete return object on error */
 
        if (ACPI_FAILURE(status)) {
                acpi_ut_remove_reference(return_desc);
        }
 
-       /* Save return object on success */
-
-       else if (!walk_state->result_obj) {
-               walk_state->result_obj = return_desc;
-       }
-
        return_ACPI_STATUS(status);
 }
 
@@ -591,7 +582,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
        u32 type;
        acpi_integer value;
 
-       ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R,
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R",
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
@@ -634,7 +625,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                temp_desc = operand[0];
                if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) ==
                    ACPI_DESC_TYPE_OPERAND) {
-
                        /* Internal reference object - prevent deletion */
 
                        acpi_ut_add_reference(temp_desc);
@@ -699,7 +689,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
-
                /* Allocate a descriptor to hold the type. */
 
                return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
@@ -788,25 +777,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 
                /* Check for a method local or argument, or standalone String */
 
-               if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) ==
+               if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) !=
                    ACPI_DESC_TYPE_NAMED) {
-                       temp_desc =
-                           acpi_ns_get_attached_object((struct
-                                                        acpi_namespace_node *)
-                                                       operand[0]);
-                       if (temp_desc
-                           &&
-                           ((ACPI_GET_OBJECT_TYPE(temp_desc) ==
-                             ACPI_TYPE_STRING)
-                            || (ACPI_GET_OBJECT_TYPE(temp_desc) ==
-                                ACPI_TYPE_LOCAL_REFERENCE))) {
-                               operand[0] = temp_desc;
-                               acpi_ut_add_reference(temp_desc);
-                       } else {
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
-                       }
-               } else {
                        switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
                        case ACPI_TYPE_LOCAL_REFERENCE:
                                /*
@@ -855,35 +827,26 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                break;
 
                        case ACPI_TYPE_STRING:
-                               break;
 
-                       default:
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
-                       }
-               }
-
-               if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) !=
-                   ACPI_DESC_TYPE_NAMED) {
-                       if (ACPI_GET_OBJECT_TYPE(operand[0]) ==
-                           ACPI_TYPE_STRING) {
                                /*
                                 * This is a deref_of (String). The string is a reference
                                 * to a named ACPI object.
                                 *
                                 * 1) Find the owning Node
-                                * 2) Dereference the node to an actual object. Could be a
+                                * 2) Dereference the node to an actual object.  Could be a
                                 *    Field, so we need to resolve the node to a value.
                                 */
                                status =
-                                   acpi_ns_get_node(walk_state->scope_info->
-                                                    scope.node,
-                                                    operand[0]->string.pointer,
-                                                    ACPI_NS_SEARCH_PARENT,
-                                                    ACPI_CAST_INDIRECT_PTR
-                                                    (struct
-                                                     acpi_namespace_node,
-                                                     &return_desc));
+                                   acpi_ns_get_node_by_path(operand[0]->string.
+                                                            pointer,
+                                                            walk_state->
+                                                            scope_info->scope.
+                                                            node,
+                                                            ACPI_NS_SEARCH_PARENT,
+                                                            ACPI_CAST_INDIRECT_PTR
+                                                            (struct
+                                                             acpi_namespace_node,
+                                                             &return_desc));
                                if (ACPI_FAILURE(status)) {
                                        goto cleanup;
                                }
@@ -894,6 +857,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                     (struct acpi_namespace_node, &return_desc),
                                     walk_state);
                                goto cleanup;
+
+                       default:
+
+                               status = AE_AML_OPERAND_TYPE;
+                               goto cleanup;
                        }
                }
 
@@ -969,12 +937,13 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                                acpi_ut_add_reference
                                                    (return_desc);
                                        }
+
                                        break;
 
                                default:
 
                                        ACPI_ERROR((AE_INFO,
-                                                   "Unknown Index TargetType %X in obj %p",
+                                                   "Unknown Index target_type %X in obj %p",
                                                    operand[0]->reference.
                                                    target_type, operand[0]));
                                        status = AE_AML_OPERAND_TYPE;
@@ -988,6 +957,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 
                                if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) ==
                                    ACPI_DESC_TYPE_NAMED) {
+
                                        return_desc =
                                            acpi_ns_get_attached_object((struct
                                                                         acpi_namespace_node
@@ -1002,7 +972,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 
                        default:
                                ACPI_ERROR((AE_INFO,
-                                           "Unknown opcode in reference(%p) - %X",
+                                           "Unknown opcode in ref(%p) - %X",
                                            operand[0],
                                            operand[0]->reference.opcode));
 
@@ -1028,11 +998,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                acpi_ut_remove_reference(return_desc);
        }
 
-       /* Save return object on success */
-
-       else {
-               walk_state->result_obj = return_desc;
-       }
-
+       walk_state->result_obj = return_desc;
        return_ACPI_STATUS(status);
 }