[ALSA] ucb1400_ts.c compilation fix (struct snd_ac97)
[powerpc.git] / drivers / acpi / dispatcher / dsutils.c
index 83ae1c1..e4073e0 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2007, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -68,7 +68,7 @@ ACPI_MODULE_NAME("dsutils")
  ******************************************************************************/
 void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state)
 {
-       ACPI_FUNCTION_NAME("ds_clear_implicit_return");
+       ACPI_FUNCTION_NAME(ds_clear_implicit_return);
 
        /*
         * Slack must be enabled for this feature
@@ -115,7 +115,7 @@ u8
 acpi_ds_do_implicit_return(union acpi_operand_object *return_desc,
                           struct acpi_walk_state *walk_state, u8 add_reference)
 {
-       ACPI_FUNCTION_NAME("ds_do_implicit_return");
+       ACPI_FUNCTION_NAME(ds_do_implicit_return);
 
        /*
         * Slack must be enabled for this feature, and we must
@@ -171,13 +171,13 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
 {
        const struct acpi_opcode_info *parent_info;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_is_result_used", op);
+       ACPI_FUNCTION_TRACE_PTR(ds_is_result_used, op);
 
        /* Must have both an Op and a Result Object */
 
        if (!op) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
-               return_VALUE(TRUE);
+               ACPI_ERROR((AE_INFO, "Null Op"));
+               return_UINT8(TRUE);
        }
 
        /*
@@ -202,13 +202,14 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
         */
        if ((!op->common.parent) ||
            (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
+
                /* No parent, the return value cannot possibly be used */
 
                ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
                                  "At Method level, result of [%s] not used\n",
                                  acpi_ps_get_opcode_name(op->common.
                                                          aml_opcode)));
-               return_VALUE(FALSE);
+               return_UINT8(FALSE);
        }
 
        /* Get info on the parent. The root_op is AML_SCOPE */
@@ -216,9 +217,8 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
        parent_info =
            acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode);
        if (parent_info->class == AML_CLASS_UNKNOWN) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Unknown parent opcode. Op=%p\n", op));
-               return_VALUE(FALSE);
+               ACPI_ERROR((AE_INFO, "Unknown parent opcode Op=%p", op));
+               return_UINT8(FALSE);
        }
 
        /*
@@ -304,7 +304,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
                          acpi_ps_get_opcode_name(op->common.parent->common.
                                                  aml_opcode), op));
 
-       return_VALUE(TRUE);
+       return_UINT8(TRUE);
 
       result_not_used:
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
@@ -313,7 +313,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
                          acpi_ps_get_opcode_name(op->common.parent->common.
                                                  aml_opcode), op));
 
-       return_VALUE(FALSE);
+       return_UINT8(FALSE);
 }
 
 /*******************************************************************************
@@ -341,10 +341,10 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
        union acpi_operand_object *obj_desc;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj);
+       ACPI_FUNCTION_TRACE_PTR(ds_delete_result_if_not_used, result_obj);
 
        if (!op) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
+               ACPI_ERROR((AE_INFO, "Null Op"));
                return_VOID;
        }
 
@@ -353,6 +353,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
        }
 
        if (!acpi_ds_is_result_used(op, walk_state)) {
+
                /* Must pop the result stack (obj_desc should be equal to result_obj) */
 
                status = acpi_ds_result_pop(&obj_desc, walk_state);
@@ -383,7 +384,7 @@ acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state)
        u32 i;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_resolve_operands", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ds_resolve_operands, walk_state);
 
        /*
         * Attempt to resolve each of the valid operands
@@ -418,7 +419,7 @@ void acpi_ds_clear_operands(struct acpi_walk_state *walk_state)
 {
        u32 i;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_clear_operands", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ds_clear_operands, walk_state);
 
        /* Remove a reference on each operand on the stack */
 
@@ -466,7 +467,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
        acpi_interpreter_mode interpreter_mode;
        const struct acpi_opcode_info *op_info;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_create_operand", arg);
+       ACPI_FUNCTION_TRACE_PTR(ds_create_operand, arg);
 
        /* A valid name must be looked up in the namespace */
 
@@ -499,7 +500,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
                 */
                if ((walk_state->deferred_node) &&
                    (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD)
-                   && (arg_index != 0)) {
+                   && (arg_index ==
+                       (u32) ((walk_state->opcode ==
+                               AML_CREATE_FIELD_OP) ? 3 : 2))) {
                        obj_desc =
                            ACPI_CAST_PTR(union acpi_operand_object,
                                          walk_state->deferred_node);
@@ -522,6 +525,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
                            && (parent_op->common.aml_opcode != AML_REGION_OP)
                            && (parent_op->common.aml_opcode !=
                                AML_INT_NAMEPATH_OP)) {
+
                                /* Enter name into namespace if not found */
 
                                interpreter_mode = ACPI_IMODE_LOAD_PASS2;
@@ -567,13 +571,13 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
                        }
 
                        if (ACPI_FAILURE(status)) {
-                               ACPI_REPORT_NSERROR(name_string, status);
+                               ACPI_ERROR_NAMESPACE(name_string, status);
                        }
                }
 
                /* Free the namestring created above */
 
-               ACPI_MEM_FREE(name_string);
+               ACPI_FREE(name_string);
 
                /* Check status from the lookup */
 
@@ -616,7 +620,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
 
                if (op_info->flags & AML_HAS_RETVAL) {
                        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-                                         "Argument previously created, already stacked \n"));
+                                         "Argument previously created, already stacked\n"));
 
                        ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
                                           (walk_state->
@@ -635,10 +639,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
                                 * Only error is underflow, and this indicates
                                 * a missing or null operand!
                                 */
-                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                                 "Missing or null operand, %s\n",
-                                                 acpi_format_exception
-                                                 (status)));
+                               ACPI_EXCEPTION((AE_INFO, status,
+                                               "Missing or null operand"));
                                return_ACPI_STATUS(status);
                        }
                } else {
@@ -699,7 +701,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state,
        union acpi_parse_object *arg;
        u32 arg_count = 0;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_create_operands", first_arg);
+       ACPI_FUNCTION_TRACE_PTR(ds_create_operands, first_arg);
 
        /* For all arguments in the list... */
 
@@ -730,7 +732,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state,
         */
        (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state);
 
-       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
-                         (arg_count + 1), acpi_format_exception(status)));
+       ACPI_EXCEPTION((AE_INFO, status, "While creating Arg %d",
+                       (arg_count + 1)));
        return_ACPI_STATUS(status);
 }