ACPICA 20050708 from Bob Moore <robert.moore@intel.com>

The use of the CPU stack in the debug version of the
subsystem has been considerably reduced.  Previously, a
debug structure was declared in every function that used
the debug macros.  This structure has been removed in
favor of declaring the individual elements as parameters
to the debug functions.  This reduces the cumulative stack
use during nested execution of ACPI function calls at the
cost of a small increase in the code size of the debug
version of the subsystem.  With assistance from Alexey
Starikovskiy and Len Brown.

Added the ACPI_GET_FUNCTION_NAME macro to enable the
compiler-dependent headers to define a macro that will
return the current function name at runtime (such as
__FUNCTION__ or _func_, etc.) The function name is used
by the debug trace output.  If ACPI_GET_FUNCTION_NAME
is not defined in the compiler-dependent header, the
function name is saved on the CPU stack (one pointer per
function.) This mechanism is used because apparently there
exists no standard ANSI-C defined macro that that returns
the function name.

Alexey Starikovskiy redesigned and reimplemented the
"Owner ID" mechanism used to track namespace objects
created/deleted by ACPI tables and control method
execution.  A bitmap is now used to allocate and free the
IDs, thus solving the wraparound problem present in the
previous implementation.  The size of the namespace node
descriptor was reduced by 2 bytes as a result.

Removed the UINT32_BIT and UINT16_BIT types that were used
for the bitfield flag definitions within the headers for
the predefined ACPI tables.  These have been replaced by
UINT8_BIT in order to increase the code portability of
the subsystem.  If the use of UINT8 remains a problem,
we may be forced to eliminate bitfields entirely because
of a lack of portability.

Alexey Starikovksiy enhanced the performance of
acpi_ut_update_object_reference.  This is a frequently used
function and this improvement increases the performance
of the entire subsystem.

Alexey Starikovskiy fixed several possible memory leaks
and the inverse - premature object deletion.

Signed-off-by: Len Brown <len.brown@intel.com>
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index 08362f6..3d5fbc8 100644
--- a/drivers/acpi/utilities/utdebug.c
+++ b/drivers/acpi/utilities/utdebug.c
@@ -116,10 +116,9 @@
  *
  * PARAMETERS:  requested_debug_level - Requested debug print level
  *              line_number         - Caller's line number (for error output)
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Format              - Printf format field
  *              ...                 - Optional printf arguments
  *
@@ -134,7 +133,9 @@
 acpi_ut_debug_print (
 	u32                             requested_debug_level,
 	u32                             line_number,
-	struct acpi_debug_print_info    *dbg_info,
+	char                            *function_name,
+	char                            *module_name,
+	u32                             component_id,
 	char                            *format,
 	...)
 {
@@ -146,7 +147,7 @@
 	 * Stay silent if the debug level or component ID is disabled
 	 */
 	if (!(requested_debug_level & acpi_dbg_level) ||
-		!(dbg_info->component_id & acpi_dbg_layer)) {
+		!(component_id & acpi_dbg_layer)) {
 		return;
 	}
 
@@ -169,14 +170,14 @@
 	 * Display the module name, current line number, thread ID (if requested),
 	 * current procedure nesting level, and the current procedure name
 	 */
-	acpi_os_printf ("%8s-%04ld ", dbg_info->module_name, line_number);
+	acpi_os_printf ("%8s-%04ld ", module_name, line_number);
 
 	if (ACPI_LV_THREADS & acpi_dbg_level) {
 		acpi_os_printf ("[%04lX] ", thread_id);
 	}
 
 	acpi_os_printf ("[%02ld] %-22.22s: ",
-		acpi_gbl_nesting_level, dbg_info->proc_name);
+		acpi_gbl_nesting_level, function_name);
 
 	va_start (args, format);
 	acpi_os_vprintf (format, args);
@@ -190,10 +191,9 @@
  *
  * PARAMETERS:  requested_debug_level - Requested debug print level
  *              line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Format              - Printf format field
  *              ...                 - Optional printf arguments
  *
@@ -208,7 +208,9 @@
 acpi_ut_debug_print_raw (
 	u32                             requested_debug_level,
 	u32                             line_number,
-	struct acpi_debug_print_info    *dbg_info,
+	char                            *function_name,
+	char                            *module_name,
+	u32                             component_id,
 	char                            *format,
 	...)
 {
@@ -216,7 +218,7 @@
 
 
 	if (!(requested_debug_level & acpi_dbg_level) ||
-		!(dbg_info->component_id & acpi_dbg_layer)) {
+		!(component_id & acpi_dbg_layer)) {
 		return;
 	}
 
@@ -231,10 +233,9 @@
  * FUNCTION:    acpi_ut_trace
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *
  * RETURN:      None
  *
@@ -246,14 +247,17 @@
 void
 acpi_ut_trace (
 	u32                             line_number,
-	struct acpi_debug_print_info    *dbg_info)
+	char                            *function_name,
+	char                            *module_name,
+	u32                             component_id)
 {
 
 	acpi_gbl_nesting_level++;
 	acpi_ut_track_stack_ptr ();
 
-	acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-			"%s\n", acpi_gbl_fn_entry_str);
+	acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
+		line_number, function_name, module_name, component_id,
+		"%s\n", acpi_gbl_fn_entry_str);
 }
 EXPORT_SYMBOL(acpi_ut_trace);
 
@@ -263,10 +267,9 @@
  * FUNCTION:    acpi_ut_trace_ptr
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Pointer             - Pointer to display
  *
  * RETURN:      None
@@ -279,14 +282,17 @@
 void
 acpi_ut_trace_ptr (
 	u32                             line_number,
-	struct acpi_debug_print_info    *dbg_info,
+	char                            *function_name,
+	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, dbg_info,
-			"%s %p\n", acpi_gbl_fn_entry_str, pointer);
+	acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
+		line_number, function_name, module_name, component_id,
+		"%s %p\n", acpi_gbl_fn_entry_str, pointer);
 }
 
 
@@ -295,10 +301,9 @@
  * FUNCTION:    acpi_ut_trace_str
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              String              - Additional string to display
  *
  * RETURN:      None
@@ -311,15 +316,18 @@
 void
 acpi_ut_trace_str (
 	u32                             line_number,
-	struct acpi_debug_print_info    *dbg_info,
+	char                            *function_name,
+	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, dbg_info,
-			"%s %s\n", acpi_gbl_fn_entry_str, string);
+	acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
+		line_number, function_name, module_name, component_id,
+		"%s %s\n", acpi_gbl_fn_entry_str, string);
 }
 
 
@@ -328,10 +336,9 @@
  * FUNCTION:    acpi_ut_trace_u32
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Integer             - Integer to display
  *
  * RETURN:      None
@@ -344,15 +351,18 @@
 void
 acpi_ut_trace_u32 (
 	u32                             line_number,
-	struct acpi_debug_print_info    *dbg_info,
+	char                            *function_name,
+	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, dbg_info,
-			"%s %08X\n", acpi_gbl_fn_entry_str, integer);
+	acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
+		line_number, function_name, module_name, component_id,
+		"%s %08X\n", acpi_gbl_fn_entry_str, integer);
 }
 
 
@@ -361,10 +371,9 @@
  * FUNCTION:    acpi_ut_exit
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *
  * RETURN:      None
  *
@@ -376,11 +385,14 @@
 void
 acpi_ut_exit (
 	u32                             line_number,
-	struct acpi_debug_print_info    *dbg_info)
+	char                            *function_name,
+	char                            *module_name,
+	u32                             component_id)
 {
 
-	acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-			"%s\n", acpi_gbl_fn_exit_str);
+	acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
+		line_number, function_name, module_name, component_id,
+		"%s\n", acpi_gbl_fn_exit_str);
 
 	acpi_gbl_nesting_level--;
 }
@@ -392,10 +404,9 @@
  * FUNCTION:    acpi_ut_status_exit
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Status              - Exit status code
  *
  * RETURN:      None
@@ -408,19 +419,23 @@
 void
 acpi_ut_status_exit (
 	u32                             line_number,
-	struct acpi_debug_print_info    *dbg_info,
+	char                            *function_name,
+	char                            *module_name,
+	u32                             component_id,
 	acpi_status                     status)
 {
 
 	if (ACPI_SUCCESS (status)) {
-		acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-				"%s %s\n", acpi_gbl_fn_exit_str,
-				acpi_format_exception (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));
 	}
 	else {
-		acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-				"%s ****Exception****: %s\n", acpi_gbl_fn_exit_str,
-				acpi_format_exception (status));
+		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_gbl_nesting_level--;
@@ -433,10 +448,9 @@
  * FUNCTION:    acpi_ut_value_exit
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Value               - Value to be printed with exit msg
  *
  * RETURN:      None
@@ -449,13 +463,16 @@
 void
 acpi_ut_value_exit (
 	u32                             line_number,
-	struct acpi_debug_print_info    *dbg_info,
+	char                            *function_name,
+	char                            *module_name,
+	u32                             component_id,
 	acpi_integer                    value)
 {
 
-	acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-			"%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str,
-			ACPI_FORMAT_UINT64 (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_gbl_nesting_level--;
 }
@@ -467,10 +484,9 @@
  * FUNCTION:    acpi_ut_ptr_exit
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Ptr                 - Pointer to display
  *
  * RETURN:      None
@@ -483,12 +499,15 @@
 void
 acpi_ut_ptr_exit (
 	u32                             line_number,
-	struct acpi_debug_print_info    *dbg_info,
+	char                            *function_name,
+	char                            *module_name,
+	u32                             component_id,
 	u8                              *ptr)
 {
 
-	acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-			"%s %p\n", acpi_gbl_fn_exit_str, 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_gbl_nesting_level--;
 }