Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / acpi / executer / exstoren.c
index d3677fe..42967ba 100644 (file)
@@ -7,7 +7,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exstoren")
-
+ACPI_MODULE_NAME("exstoren")
 
 /*******************************************************************************
  *
  *              it and return the actual object in the source_desc_ptr.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_resolve_object (
-       union acpi_operand_object       **source_desc_ptr,
-       acpi_object_type                target_type,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
+                      acpi_object_type target_type,
+                      struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       *source_desc = *source_desc_ptr;
-       acpi_status                     status = AE_OK;
-
+       union acpi_operand_object *source_desc = *source_desc_ptr;
+       acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE ("ex_resolve_object");
+       ACPI_FUNCTION_TRACE("ex_resolve_object");
 
+       /* Ensure we have a Target that can be stored to */
 
-       /*
-        * Ensure we have a Target that can be stored to
-        */
        switch (target_type) {
        case ACPI_TYPE_BUFFER_FIELD:
        case ACPI_TYPE_LOCAL_REGION_FIELD:
@@ -103,11 +95,14 @@ acpi_ex_resolve_object (
                 * are all essentially the same.  This case handles the
                 * "interchangeable" types Integer, String, and Buffer.
                 */
-               if (ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
+               if (ACPI_GET_OBJECT_TYPE(source_desc) ==
+                   ACPI_TYPE_LOCAL_REFERENCE) {
                        /* Resolve a reference object first */
 
-                       status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state);
-                       if (ACPI_FAILURE (status)) {
+                       status =
+                           acpi_ex_resolve_to_value(source_desc_ptr,
+                                                    walk_state);
+                       if (ACPI_FAILURE(status)) {
                                break;
                        }
                }
@@ -118,36 +113,35 @@ acpi_ex_resolve_object (
                        break;
                }
 
-               /*
-                * Must have a Integer, Buffer, or String
-                */
-               if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER)   &&
-                       (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER)    &&
-                       (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING)    &&
-                       !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) {
-                       /*
-                        * Conversion successful but still not a valid type
-                        */
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
-                               acpi_ut_get_object_type_name (source_desc),
-                               acpi_ut_get_type_name (target_type)));
+               /* Must have a Integer, Buffer, or String */
+
+               if ((ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) &&
+                   (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) &&
+                   (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) &&
+                   !((ACPI_GET_OBJECT_TYPE(source_desc) ==
+                      ACPI_TYPE_LOCAL_REFERENCE)
+                     && (source_desc->reference.opcode == AML_LOAD_OP))) {
+                       /* Conversion successful but still not a valid type */
+
+                       ACPI_ERROR((AE_INFO,
+                                   "Cannot assign type %s to %s (must be type Int/Str/Buf)",
+                                   acpi_ut_get_object_type_name(source_desc),
+                                   acpi_ut_get_type_name(target_type)));
                        status = AE_AML_OPERAND_TYPE;
                }
                break;
 
-
        case ACPI_TYPE_LOCAL_ALIAS:
        case ACPI_TYPE_LOCAL_METHOD_ALIAS:
 
                /*
-                * Aliases are resolved by acpi_ex_prep_operands
+                * All aliases should have been resolved earlier, during the
+                * operand resolution phase.
                 */
-               ACPI_REPORT_ERROR (("Store into Alias - should never happen\n"));
+               ACPI_ERROR((AE_INFO, "Store into an unresolved Alias object"));
                status = AE_AML_INTERNAL;
                break;
 
-
        case ACPI_TYPE_PACKAGE:
        default:
 
@@ -158,10 +152,9 @@ acpi_ex_resolve_object (
                break;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_store_object_to_object
@@ -198,18 +191,15 @@ acpi_ex_resolve_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_store_object_to_object (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *dest_desc,
-       union acpi_operand_object       **new_desc,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
+                              union acpi_operand_object *dest_desc,
+                              union acpi_operand_object **new_desc,
+                              struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       *actual_src_desc;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_object", source_desc);
+       union acpi_operand_object *actual_src_desc;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc);
 
        actual_src_desc = source_desc;
        if (!dest_desc) {
@@ -218,11 +208,14 @@ acpi_ex_store_object_to_object (
                 * package element), so we can simply copy the source object
                 * creating a new destination object
                 */
-               status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, new_desc, walk_state);
-               return_ACPI_STATUS (status);
+               status =
+                   acpi_ut_copy_iobject_to_iobject(actual_src_desc, new_desc,
+                                                   walk_state);
+               return_ACPI_STATUS(status);
        }
 
-       if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_GET_OBJECT_TYPE (dest_desc)) {
+       if (ACPI_GET_OBJECT_TYPE(source_desc) !=
+           ACPI_GET_OBJECT_TYPE(dest_desc)) {
                /*
                 * The source type does not match the type of the destination.
                 * Perform the "implicit conversion" of the source to the current type
@@ -232,10 +225,13 @@ acpi_ex_store_object_to_object (
                 * Otherwise, actual_src_desc is a temporary object to hold the
                 * converted object.
                 */
-               status = acpi_ex_convert_to_target_type (ACPI_GET_OBJECT_TYPE (dest_desc),
-                                 source_desc, &actual_src_desc, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ex_convert_to_target_type(ACPI_GET_OBJECT_TYPE
+                                                  (dest_desc), source_desc,
+                                                  &actual_src_desc,
+                                                  walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                if (source_desc == actual_src_desc) {
@@ -244,7 +240,7 @@ acpi_ex_store_object_to_object (
                         * new object.
                         */
                        *new_desc = source_desc;
-                       return_ACPI_STATUS (AE_OK);
+                       return_ACPI_STATUS(AE_OK);
                }
        }
 
@@ -252,42 +248,41 @@ acpi_ex_store_object_to_object (
         * We now have two objects of identical types, and we can perform a
         * copy of the *value* of the source object.
         */
-       switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(dest_desc)) {
        case ACPI_TYPE_INTEGER:
 
                dest_desc->integer.value = actual_src_desc->integer.value;
 
                /* Truncate value if we are executing from a 32-bit ACPI table */
 
-               acpi_ex_truncate_for32bit_table (dest_desc);
+               acpi_ex_truncate_for32bit_table(dest_desc);
                break;
 
        case ACPI_TYPE_STRING:
 
-               status = acpi_ex_store_string_to_string (actual_src_desc, dest_desc);
+               status =
+                   acpi_ex_store_string_to_string(actual_src_desc, dest_desc);
                break;
 
        case ACPI_TYPE_BUFFER:
 
-               /*
-                * Note: There is different store behavior depending on the original
-                * source type
-                */
-               status = acpi_ex_store_buffer_to_buffer (actual_src_desc, dest_desc);
+               status =
+                   acpi_ex_store_buffer_to_buffer(actual_src_desc, dest_desc);
                break;
 
        case ACPI_TYPE_PACKAGE:
 
-               status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, &dest_desc,
-                                walk_state);
+               status =
+                   acpi_ut_copy_iobject_to_iobject(actual_src_desc, &dest_desc,
+                                                   walk_state);
                break;
 
        default:
                /*
                 * All other types come here.
                 */
-               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n",
-                       acpi_ut_get_object_type_name (dest_desc)));
+               ACPI_WARNING((AE_INFO, "Store into type %s not implemented",
+                             acpi_ut_get_object_type_name(dest_desc)));
 
                status = AE_NOT_IMPLEMENTED;
                break;
@@ -296,11 +291,9 @@ acpi_ex_store_object_to_object (
        if (actual_src_desc != source_desc) {
                /* Delete the intermediate (temporary) source object */
 
-               acpi_ut_remove_reference (actual_src_desc);
+               acpi_ut_remove_reference(actual_src_desc);
        }
 
        *new_desc = dest_desc;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-