diff options
Diffstat (limited to 'include/acpi')
-rw-r--r-- | include/acpi/acoutput.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 38e1be09465..be014bf7efe 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h @@ -263,16 +263,42 @@ * Common parameters used for debug output functions: * line number, function name, module(file) name, component ID */ -#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT +#define ACPI_DEBUG_PARAMETERS \ + __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT /* * Master debug print macros * Print message if and only if: * 1) Debug print for the current component is enabled * 2) Debug error level or trace level for the print statement is enabled + * + * November 2012: Moved the runtime check for whether to actually emit the + * debug message outside of the print function itself. This improves overall + * performance at a relatively small code cost. Implementation involves the + * use of variadic macros supported by C99. */ -#define ACPI_DEBUG_PRINT(plist) acpi_debug_print plist -#define ACPI_DEBUG_PRINT_RAW(plist) acpi_debug_print_raw plist + +/* DEBUG_PRINT functions */ + +#define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist +#define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist + +/* Helper macros for DEBUG_PRINT */ + +#define ACPI_IS_DEBUG_ENABLED(level, component) \ + (level & acpi_dbg_level) && (component & acpi_dbg_layer) + +#define ACPI_DEBUG(function, level, line, filename, modulename, component, ...) \ + if (ACPI_IS_DEBUG_ENABLED (level, component)) \ + { \ + function (level, line, filename, modulename, component, __VA_ARGS__); \ + } + +#define ACPI_ACTUAL_DEBUG(level, line, filename, modulename, component, ...) \ + ACPI_DEBUG (acpi_debug_print, level, line, filename, modulename, component, __VA_ARGS__) + +#define ACPI_ACTUAL_DEBUG_RAW(level, line, filename, modulename, component, ...) \ + ACPI_DEBUG (acpi_debug_print_raw, level, line, filename, modulename, component, __VA_ARGS__) #else /* |