ACPICA: Restructure includes into public/private
[deliverable/linux.git] / drivers / acpi / utilities / utdebug.c
index 7361204b1eef2114ca22a65902dae2b6ae75276f..9a3538c497d0cbc6d9401c79221deee59bcb31ce 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2007, R. Byron Moore
+ * Copyright (C) 2000 - 2008, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,7 @@
  */
 
 #include <acpi/acpi.h>
+#include <acpi/accommon.h>
 
 #define _COMPONENT          ACPI_UTILITIES
 ACPI_MODULE_NAME("utdebug")
@@ -68,9 +69,9 @@ static const char *acpi_ut_trim_function_name(const char *function_name);
 
 void acpi_ut_init_stack_ptr_trace(void)
 {
-       u32 current_sp;
+       acpi_size current_sp;
 
-       acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF(&current_sp, NULL);
+       acpi_gbl_entry_stack_pointer = &current_sp;
 }
 
 /*******************************************************************************
@@ -89,10 +90,8 @@ void acpi_ut_track_stack_ptr(void)
 {
        acpi_size current_sp;
 
-       current_sp = ACPI_PTR_DIFF(&current_sp, NULL);
-
-       if (current_sp < acpi_gbl_lowest_stack_pointer) {
-               acpi_gbl_lowest_stack_pointer = current_sp;
+       if (&current_sp < acpi_gbl_lowest_stack_pointer) {
+               acpi_gbl_lowest_stack_pointer = &current_sp;
        }
 
        if (acpi_gbl_nesting_level > acpi_gbl_deepest_nesting) {
@@ -138,7 +137,7 @@ static const char *acpi_ut_trim_function_name(const char *function_name)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ut_debug_print
+ * FUNCTION:    acpi_debug_print
  *
  * PARAMETERS:  requested_debug_level - Requested debug print level
  *              line_number         - Caller's line number (for error output)
@@ -156,10 +155,11 @@ static const char *acpi_ut_trim_function_name(const char *function_name)
  ******************************************************************************/
 
 void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_debug_print(u32 requested_debug_level,
-                   u32 line_number,
-                   const char *function_name,
-                   char *module_name, u32 component_id, char *format, ...)
+acpi_debug_print(u32 requested_debug_level,
+                u32 line_number,
+                const char *function_name,
+                const char *module_name,
+                u32 component_id, const char *format, ...)
 {
        acpi_thread_id thread_id;
        va_list args;
@@ -203,13 +203,14 @@ acpi_ut_debug_print(u32 requested_debug_level,
 
        va_start(args, format);
        acpi_os_vprintf(format, args);
+       va_end(args);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_ut_debug_print)
+ACPI_EXPORT_SYMBOL(acpi_debug_print)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ut_debug_print_raw
+ * FUNCTION:    acpi_debug_print_raw
  *
  * PARAMETERS:  requested_debug_level - Requested debug print level
  *              line_number         - Caller's line number
@@ -226,10 +227,11 @@ ACPI_EXPORT_SYMBOL(acpi_ut_debug_print)
  *
  ******************************************************************************/
 void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_debug_print_raw(u32 requested_debug_level,
-                       u32 line_number,
-                       const char *function_name,
-                       char *module_name, u32 component_id, char *format, ...)
+acpi_debug_print_raw(u32 requested_debug_level,
+                    u32 line_number,
+                    const char *function_name,
+                    const char *module_name,
+                    u32 component_id, const char *format, ...)
 {
        va_list args;
 
@@ -240,9 +242,10 @@ acpi_ut_debug_print_raw(u32 requested_debug_level,
 
        va_start(args, format);
        acpi_os_vprintf(format, args);
+       va_end(args);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw)
+ACPI_EXPORT_SYMBOL(acpi_debug_print_raw)
 
 /*******************************************************************************
  *
@@ -261,15 +264,16 @@ ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw)
  ******************************************************************************/
 void
 acpi_ut_trace(u32 line_number,
-             const char *function_name, char *module_name, u32 component_id)
+             const char *function_name,
+             const char *module_name, u32 component_id)
 {
 
        acpi_gbl_nesting_level++;
        acpi_ut_track_stack_ptr();
 
-       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
-                           line_number, function_name, module_name,
-                           component_id, "%s\n", acpi_gbl_fn_entry_str);
+       acpi_debug_print(ACPI_LV_FUNCTIONS,
+                        line_number, function_name, module_name, component_id,
+                        "%s\n", acpi_gbl_fn_entry_str);
 }
 
 ACPI_EXPORT_SYMBOL(acpi_ut_trace)
@@ -293,15 +297,14 @@ ACPI_EXPORT_SYMBOL(acpi_ut_trace)
 void
 acpi_ut_trace_ptr(u32 line_number,
                  const char *function_name,
-                 char *module_name, u32 component_id, void *pointer)
+                 const char *module_name, u32 component_id, void *pointer)
 {
        acpi_gbl_nesting_level++;
        acpi_ut_track_stack_ptr();
 
-       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
-                           line_number, function_name, module_name,
-                           component_id, "%s %p\n", acpi_gbl_fn_entry_str,
-                           pointer);
+       acpi_debug_print(ACPI_LV_FUNCTIONS,
+                        line_number, function_name, module_name, component_id,
+                        "%s %p\n", acpi_gbl_fn_entry_str, pointer);
 }
 
 /*******************************************************************************
@@ -324,16 +327,15 @@ acpi_ut_trace_ptr(u32 line_number,
 void
 acpi_ut_trace_str(u32 line_number,
                  const char *function_name,
-                 char *module_name, u32 component_id, char *string)
+                 const char *module_name, u32 component_id, char *string)
 {
 
        acpi_gbl_nesting_level++;
        acpi_ut_track_stack_ptr();
 
-       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
-                           line_number, function_name, module_name,
-                           component_id, "%s %s\n", acpi_gbl_fn_entry_str,
-                           string);
+       acpi_debug_print(ACPI_LV_FUNCTIONS,
+                        line_number, function_name, module_name, component_id,
+                        "%s %s\n", acpi_gbl_fn_entry_str, string);
 }
 
 /*******************************************************************************
@@ -356,16 +358,15 @@ acpi_ut_trace_str(u32 line_number,
 void
 acpi_ut_trace_u32(u32 line_number,
                  const char *function_name,
-                 char *module_name, u32 component_id, u32 integer)
+                 const char *module_name, u32 component_id, u32 integer)
 {
 
        acpi_gbl_nesting_level++;
        acpi_ut_track_stack_ptr();
 
-       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
-                           line_number, function_name, module_name,
-                           component_id, "%s %08X\n", acpi_gbl_fn_entry_str,
-                           integer);
+       acpi_debug_print(ACPI_LV_FUNCTIONS,
+                        line_number, function_name, module_name, component_id,
+                        "%s %08X\n", acpi_gbl_fn_entry_str, integer);
 }
 
 /*******************************************************************************
@@ -386,12 +387,13 @@ acpi_ut_trace_u32(u32 line_number,
 
 void
 acpi_ut_exit(u32 line_number,
-            const char *function_name, char *module_name, u32 component_id)
+            const char *function_name,
+            const char *module_name, u32 component_id)
 {
 
-       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
-                           line_number, function_name, module_name,
-                           component_id, "%s\n", acpi_gbl_fn_exit_str);
+       acpi_debug_print(ACPI_LV_FUNCTIONS,
+                        line_number, function_name, module_name, component_id,
+                        "%s\n", acpi_gbl_fn_exit_str);
 
        acpi_gbl_nesting_level--;
 }
@@ -417,21 +419,21 @@ ACPI_EXPORT_SYMBOL(acpi_ut_exit)
 void
 acpi_ut_status_exit(u32 line_number,
                    const char *function_name,
-                   char *module_name, u32 component_id, acpi_status status)
+                   const char *module_name,
+                   u32 component_id, acpi_status status)
 {
 
        if (ACPI_SUCCESS(status)) {
-               acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
-                                   line_number, function_name, module_name,
-                                   component_id, "%s %s\n",
-                                   acpi_gbl_fn_exit_str,
-                                   acpi_format_exception(status));
+               acpi_debug_print(ACPI_LV_FUNCTIONS,
+                                line_number, function_name, module_name,
+                                component_id, "%s %s\n", acpi_gbl_fn_exit_str,
+                                acpi_format_exception(status));
        } else {
-               acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
-                                   line_number, function_name, module_name,
-                                   component_id, "%s ****Exception****: %s\n",
-                                   acpi_gbl_fn_exit_str,
-                                   acpi_format_exception(status));
+               acpi_debug_print(ACPI_LV_FUNCTIONS,
+                                line_number, function_name, module_name,
+                                component_id, "%s ****Exception****: %s\n",
+                                acpi_gbl_fn_exit_str,
+                                acpi_format_exception(status));
        }
 
        acpi_gbl_nesting_level--;
@@ -458,13 +460,14 @@ ACPI_EXPORT_SYMBOL(acpi_ut_status_exit)
 void
 acpi_ut_value_exit(u32 line_number,
                   const char *function_name,
-                  char *module_name, u32 component_id, acpi_integer value)
+                  const char *module_name,
+                  u32 component_id, acpi_integer value)
 {
 
-       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
-                           line_number, function_name, module_name,
-                           component_id, "%s %8.8X%8.8X\n",
-                           acpi_gbl_fn_exit_str, ACPI_FORMAT_UINT64(value));
+       acpi_debug_print(ACPI_LV_FUNCTIONS,
+                        line_number, function_name, module_name, component_id,
+                        "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str,
+                        ACPI_FORMAT_UINT64(value));
 
        acpi_gbl_nesting_level--;
 }
@@ -490,12 +493,12 @@ ACPI_EXPORT_SYMBOL(acpi_ut_value_exit)
 void
 acpi_ut_ptr_exit(u32 line_number,
                 const char *function_name,
-                char *module_name, u32 component_id, u8 * ptr)
+                const char *module_name, u32 component_id, u8 *ptr)
 {
 
-       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
-                           line_number, function_name, module_name,
-                           component_id, "%s %p\n", acpi_gbl_fn_exit_str, ptr);
+       acpi_debug_print(ACPI_LV_FUNCTIONS,
+                        line_number, function_name, module_name, component_id,
+                        "%s %p\n", acpi_gbl_fn_exit_str, ptr);
 
        acpi_gbl_nesting_level--;
 }
@@ -519,11 +522,16 @@ acpi_ut_ptr_exit(u32 line_number,
 
 void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
 {
-       acpi_native_uint i = 0;
-       acpi_native_uint j;
+       u32 i = 0;
+       u32 j;
        u32 temp32;
        u8 buf_char;
 
+       if (!buffer) {
+               acpi_os_printf("Null Buffer Pointer in DumpBuffer!\n");
+               return;
+       }
+
        if ((count < 4) || (count & 0x01)) {
                display = DB_BYTE_DISPLAY;
        }
@@ -534,7 +542,7 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
 
                /* Print current offset */
 
-               acpi_os_printf("%6.4X: ", (u32) i);
+               acpi_os_printf("%6.4X: ", i);
 
                /* Print 16 hex chars */
 
@@ -544,7 +552,7 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
                                /* Dump fill spaces */
 
                                acpi_os_printf("%*s", ((display * 2) + 1), " ");
-                               j += (acpi_native_uint) display;
+                               j += display;
                                continue;
                        }
 
@@ -552,32 +560,38 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
                        case DB_BYTE_DISPLAY:
                        default:        /* Default is BYTE display */
 
-                               acpi_os_printf("%02X ", buffer[i + j]);
+                               acpi_os_printf("%02X ",
+                                              buffer[(acpi_size) i + j]);
                                break;
 
                        case DB_WORD_DISPLAY:
 
-                               ACPI_MOVE_16_TO_32(&temp32, &buffer[i + j]);
+                               ACPI_MOVE_16_TO_32(&temp32,
+                                                  &buffer[(acpi_size) i + j]);
                                acpi_os_printf("%04X ", temp32);
                                break;
 
                        case DB_DWORD_DISPLAY:
 
-                               ACPI_MOVE_32_TO_32(&temp32, &buffer[i + j]);
+                               ACPI_MOVE_32_TO_32(&temp32,
+                                                  &buffer[(acpi_size) i + j]);
                                acpi_os_printf("%08X ", temp32);
                                break;
 
                        case DB_QWORD_DISPLAY:
 
-                               ACPI_MOVE_32_TO_32(&temp32, &buffer[i + j]);
+                               ACPI_MOVE_32_TO_32(&temp32,
+                                                  &buffer[(acpi_size) i + j]);
                                acpi_os_printf("%08X", temp32);
 
-                               ACPI_MOVE_32_TO_32(&temp32, &buffer[i + j + 4]);
+                               ACPI_MOVE_32_TO_32(&temp32,
+                                                  &buffer[(acpi_size) i + j +
+                                                          4]);
                                acpi_os_printf("%08X ", temp32);
                                break;
                        }
 
-                       j += (acpi_native_uint) display;
+                       j += display;
                }
 
                /*
@@ -591,7 +605,7 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
                                return;
                        }
 
-                       buf_char = buffer[i + j];
+                       buf_char = buffer[(acpi_size) i + j];
                        if (ACPI_IS_PRINT(buf_char)) {
                                acpi_os_printf("%c", buf_char);
                        } else {
This page took 0.030144 seconds and 5 git commands to generate.