[ACPI] comment out prototypes for new unused debug routines
[safe/jmp/linux-2.6] / drivers / acpi / dispatcher / dsopcode.c
index 5c987a0..750bdb1 100644 (file)
 #define _COMPONENT          ACPI_DISPATCHER
         ACPI_MODULE_NAME    ("dsopcode")
 
+/* Local prototypes */
 
-/*****************************************************************************
+static acpi_status
+acpi_ds_execute_arguments (
+       struct acpi_namespace_node      *node,
+       struct acpi_namespace_node      *scope_node,
+       u32                             aml_length,
+       u8                              *aml_start);
+
+static acpi_status
+acpi_ds_init_buffer_field (
+       u16                             aml_opcode,
+       union acpi_operand_object       *obj_desc,
+       union acpi_operand_object       *buffer_desc,
+       union acpi_operand_object       *offset_desc,
+       union acpi_operand_object       *length_desc,
+       union acpi_operand_object       *result_desc);
+
+
+/*******************************************************************************
  *
  * FUNCTION:    acpi_ds_execute_arguments
  *
- * PARAMETERS:  Node                - Parent NS node
+ * PARAMETERS:  Node                - Object NS node
+ *              scope_node          - Parent NS node
  *              aml_length          - Length of executable AML
  *              aml_start           - Pointer to the AML
  *
@@ -67,9 +86,9 @@
  *
  * DESCRIPTION: Late (deferred) execution of region or field arguments
  *
- ****************************************************************************/
+ ******************************************************************************/
 
-acpi_status
+static acpi_status
 acpi_ds_execute_arguments (
        struct acpi_namespace_node      *node,
        struct acpi_namespace_node      *scope_node,
@@ -100,14 +119,15 @@ acpi_ds_execute_arguments (
 
        walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
        if (!walk_state) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               status = AE_NO_MEMORY;
+               goto cleanup;
        }
 
        status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
                          aml_length, NULL, 1);
        if (ACPI_FAILURE (status)) {
                acpi_ds_delete_walk_state (walk_state);
-               return_ACPI_STATUS (status);
+               goto cleanup;
        }
 
        /* Mark this parse as a deferred opcode */
@@ -119,8 +139,7 @@ acpi_ds_execute_arguments (
 
        status = acpi_ps_parse_aml (walk_state);
        if (ACPI_FAILURE (status)) {
-               acpi_ps_delete_parse_tree (op);
-               return_ACPI_STATUS (status);
+               goto cleanup;
        }
 
        /* Get and init the Op created above */
@@ -141,7 +160,8 @@ acpi_ds_execute_arguments (
 
        walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
        if (!walk_state) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               status = AE_NO_MEMORY;
+               goto cleanup;
        }
 
        /* Execute the opcode and arguments */
@@ -150,19 +170,21 @@ acpi_ds_execute_arguments (
                          aml_length, NULL, 3);
        if (ACPI_FAILURE (status)) {
                acpi_ds_delete_walk_state (walk_state);
-               return_ACPI_STATUS (status);
+               goto cleanup;
        }
 
        /* Mark this execution as a deferred opcode */
 
        walk_state->deferred_node = node;
        status = acpi_ps_parse_aml (walk_state);
+
+cleanup:
        acpi_ps_delete_parse_tree (op);
        return_ACPI_STATUS (status);
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    acpi_ds_get_buffer_field_arguments
  *
@@ -173,7 +195,7 @@ acpi_ds_execute_arguments (
  * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late
  *              evaluation of these field attributes.
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 acpi_status
 acpi_ds_get_buffer_field_arguments (
@@ -208,7 +230,7 @@ acpi_ds_get_buffer_field_arguments (
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    acpi_ds_get_buffer_arguments
  *
@@ -219,7 +241,7 @@ acpi_ds_get_buffer_field_arguments (
  * DESCRIPTION: Get Buffer length and initializer byte list.  This implements
  *              the late evaluation of these attributes.
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 acpi_status
 acpi_ds_get_buffer_arguments (
@@ -255,7 +277,7 @@ acpi_ds_get_buffer_arguments (
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    acpi_ds_get_package_arguments
  *
@@ -266,7 +288,7 @@ acpi_ds_get_buffer_arguments (
  * DESCRIPTION: Get Package length and initializer byte list.  This implements
  *              the late evaluation of these attributes.
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 acpi_status
 acpi_ds_get_package_arguments (
@@ -353,17 +375,17 @@ acpi_ds_get_region_arguments (
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    acpi_ds_initialize_region
  *
- * PARAMETERS:  Op              - A valid region Op object
+ * PARAMETERS:  obj_handle      - Region namespace node
  *
  * RETURN:      Status
  *
  * DESCRIPTION: Front end to ev_initialize_region
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 acpi_status
 acpi_ds_initialize_region (
@@ -382,7 +404,7 @@ acpi_ds_initialize_region (
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    acpi_ds_init_buffer_field
  *
@@ -390,16 +412,16 @@ acpi_ds_initialize_region (
  *              obj_desc        - buffer_field object
  *              buffer_desc     - Host Buffer
  *              offset_desc     - Offset into buffer
- *              Length          - Length of field (CREATE_FIELD_OP only)
- *              Result          - Where to store the result
+ *              length_desc     - Length of field (CREATE_FIELD_OP only)
+ *              result_desc     - Where to store the result
  *
  * RETURN:      Status
  *
  * DESCRIPTION: Perform actual initialization of a buffer field
  *
- ****************************************************************************/
+ ******************************************************************************/
 
-acpi_status
+static acpi_status
 acpi_ds_init_buffer_field (
        u16                             aml_opcode,
        union acpi_operand_object       *obj_desc,
@@ -435,8 +457,10 @@ acpi_ds_init_buffer_field (
         * after resolution in acpi_ex_resolve_operands().
         */
        if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination not a NS Node [%s]\n",
-                               acpi_ps_get_opcode_name (aml_opcode), acpi_ut_get_descriptor_name (result_desc)));
+               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "(%s) destination not a NS Node [%s]\n",
+                               acpi_ps_get_opcode_name (aml_opcode),
+                               acpi_ut_get_descriptor_name (result_desc)));
 
                status = AE_AML_OPERAND_TYPE;
                goto cleanup;
@@ -452,9 +476,18 @@ acpi_ds_init_buffer_field (
 
                /* Offset is in bits, count is in bits */
 
+               field_flags = AML_FIELD_ACCESS_BYTE;
                bit_offset = offset;
                bit_count  = (u32) length_desc->integer.value;
-               field_flags = AML_FIELD_ACCESS_BYTE;
+
+               /* Must have a valid (>0) bit count */
+
+               if (bit_count == 0) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                               "Attempt to create_field of length 0\n"));
+                       status = AE_AML_OPERAND_VALUE;
+                       goto cleanup;
+               }
                break;
 
        case AML_CREATE_BIT_FIELD_OP:
@@ -527,7 +560,8 @@ acpi_ds_init_buffer_field (
 
        /*
         * Initialize areas of the field object that are common to all fields
-        * For field_flags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE)
+        * For field_flags, use LOCK_RULE = 0 (NO_LOCK),
+        * UPDATE_RULE = 0 (UPDATE_PRESERVE)
         */
        status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0,
                          bit_offset, bit_count);
@@ -539,8 +573,8 @@ acpi_ds_init_buffer_field (
 
        /* Reference count for buffer_desc inherits obj_desc count */
 
-       buffer_desc->common.reference_count = (u16) (buffer_desc->common.reference_count +
-                         obj_desc->common.reference_count);
+       buffer_desc->common.reference_count = (u16)
+               (buffer_desc->common.reference_count + obj_desc->common.reference_count);
 
 
 cleanup:
@@ -569,7 +603,7 @@ cleanup:
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    acpi_ds_eval_buffer_field_operands
  *
@@ -581,7 +615,7 @@ cleanup:
  * DESCRIPTION: Get buffer_field Buffer and Index
  *              Called from acpi_ds_exec_end_op during buffer_field parse tree walk
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 acpi_status
 acpi_ds_eval_buffer_field_operands (
@@ -656,7 +690,7 @@ acpi_ds_eval_buffer_field_operands (
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    acpi_ds_eval_region_operands
  *
@@ -668,7 +702,7 @@ acpi_ds_eval_buffer_field_operands (
  * DESCRIPTION: Get region address and length
  *              Called from acpi_ds_exec_end_op during op_region parse tree walk
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 acpi_status
 acpi_ds_eval_region_operands (
@@ -686,7 +720,8 @@ acpi_ds_eval_region_operands (
 
 
        /*
-        * This is where we evaluate the address and length fields of the op_region declaration
+        * This is where we evaluate the address and length fields of the
+        * op_region declaration
         */
        node =  op->common.node;
 
@@ -707,7 +742,8 @@ acpi_ds_eval_region_operands (
 
        /* Resolve the length and address operands to numbers */
 
-       status = acpi_ex_resolve_operands (op->common.aml_opcode, ACPI_WALK_OPERANDS, walk_state);
+       status = acpi_ex_resolve_operands (op->common.aml_opcode,
+                        ACPI_WALK_OPERANDS, walk_state);
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
        }
@@ -736,7 +772,8 @@ acpi_ds_eval_region_operands (
         */
        operand_desc = walk_state->operands[walk_state->num_operands - 2];
 
-       obj_desc->region.address = (acpi_physical_address) operand_desc->integer.value;
+       obj_desc->region.address = (acpi_physical_address)
+                         operand_desc->integer.value;
        acpi_ut_remove_reference (operand_desc);
 
        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n",
@@ -752,7 +789,7 @@ acpi_ds_eval_region_operands (
 }
 
 
-/*****************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    acpi_ds_eval_data_object_operands
  *
@@ -765,7 +802,7 @@ acpi_ds_eval_region_operands (
  * DESCRIPTION: Get the operands and complete the following data object types:
  *              Buffer, Package.
  *
- ****************************************************************************/
+ ******************************************************************************/
 
 acpi_status
 acpi_ds_eval_data_object_operands (
@@ -830,7 +867,7 @@ acpi_ds_eval_data_object_operands (
 
        if (ACPI_SUCCESS (status)) {
                /*
-                * Return the object in the walk_state, unless the parent is a package --
+                * Return the object in the walk_state, unless the parent is a package -
                 * in this case, the return object will be stored in the parse tree
                 * for the package.
                 */
@@ -988,7 +1025,8 @@ acpi_ds_exec_end_control_op (
                        status = AE_CTRL_PENDING;
                }
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n", op));
+               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                       "[WHILE_OP] termination! Op=%p\n",op));
 
                /* Pop this control state and free it */