Merge git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa
[powerpc.git] / drivers / acpi / tables / tbutils.c
index 4b2fbb5..bc57159 100644 (file)
@@ -5,7 +5,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
@@ -94,9 +94,8 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc)
                     new_table_desc->pointer->length)
                    &&
                    (!ACPI_MEMCMP
-                    ((const char *)table_desc->pointer,
-                     (const char *)new_table_desc->pointer,
-                     (acpi_size) new_table_desc->pointer->length))) {
+                    (table_desc->pointer, new_table_desc->pointer,
+                     new_table_desc->pointer->length))) {
                        /* Match: this table is already installed */
 
                        ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
@@ -145,14 +144,13 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header)
 {
        acpi_name signature;
 
-       ACPI_FUNCTION_NAME("tb_validate_table_header");
+       ACPI_FUNCTION_ENTRY();
 
        /* Verify that this is a valid address */
 
        if (!acpi_os_readable(table_header, sizeof(struct acpi_table_header))) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Cannot read table header at %p\n",
-                                 table_header));
+               ACPI_ERROR((AE_INFO,
+                           "Cannot read table header at %p", table_header));
 
                return (AE_BAD_ADDRESS);
        }
@@ -161,12 +159,12 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header)
 
        ACPI_MOVE_32_TO_32(&signature, table_header->signature);
        if (!acpi_ut_valid_acpi_name(signature)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Table signature at %p [%p] has invalid characters\n",
-                                 table_header, &signature));
+               ACPI_ERROR((AE_INFO,
+                           "Table signature at %p [%p] has invalid characters",
+                           table_header, &signature));
 
-               ACPI_REPORT_WARNING(("Invalid table signature found: [%4.4s]\n",
-                                    (char *)&signature));
+               ACPI_WARNING((AE_INFO, "Invalid table signature found: [%4.4s]",
+                             ACPI_CAST_PTR(char, &signature)));
 
                ACPI_DUMP_BUFFER(table_header,
                                 sizeof(struct acpi_table_header));
@@ -176,11 +174,13 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header)
        /* Validate the table length */
 
        if (table_header->length < sizeof(struct acpi_table_header)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Invalid length in table header %p name %4.4s\n",
-                                 table_header, (char *)&signature));
+               ACPI_ERROR((AE_INFO,
+                           "Invalid length in table header %p name %4.4s",
+                           table_header, (char *)&signature));
 
-               ACPI_REPORT_WARNING(("Invalid table header length (0x%X) found\n", (u32) table_header->length));
+               ACPI_WARNING((AE_INFO,
+                             "Invalid table header length (0x%X) found",
+                             (u32) table_header->length));
 
                ACPI_DUMP_BUFFER(table_header,
                                 sizeof(struct acpi_table_header));
@@ -219,7 +219,10 @@ acpi_tb_verify_table_checksum(struct acpi_table_header * table_header)
        /* Return the appropriate exception */
 
        if (checksum) {
-               ACPI_REPORT_WARNING(("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", table_header->signature, (u32) table_header->checksum, (u32) checksum));
+               ACPI_WARNING((AE_INFO,
+                             "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)",
+                             table_header->signature,
+                             (u32) table_header->checksum, (u32) checksum));
 
                status = AE_BAD_CHECKSUM;
        }
@@ -241,16 +244,16 @@ acpi_tb_verify_table_checksum(struct acpi_table_header * table_header)
 
 u8 acpi_tb_generate_checksum(void *buffer, u32 length)
 {
-       const u8 *limit;
-       const u8 *rover;
+       u8 *end_buffer;
+       u8 *rover;
        u8 sum = 0;
 
        if (buffer && length) {
                /*  Buffer and Length are valid   */
 
-               limit = (u8 *) buffer + length;
+               end_buffer = ACPI_ADD_PTR(u8, buffer, length);
 
-               for (rover = buffer; rover < limit; rover++) {
+               for (rover = buffer; rover < end_buffer; rover++) {
                        sum = (u8) (sum + *rover);
                }
        }
@@ -292,8 +295,7 @@ acpi_tb_handle_to_object(u16 table_id,
                }
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "table_id=%X does not exist\n",
-                         table_id));
+       ACPI_ERROR((AE_INFO, "table_id=%X does not exist", table_id));
        return (AE_BAD_PARAMETER);
 }
 #endif