Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db38bf5a authored by Bob Moore's avatar Bob Moore Committed by Rafael J. Wysocki
Browse files

ACPICA: FUNCTION_TRACE macros: Check if debug is enabled up-front.



In the functions that implement the macros, check if debug
is enabled up-front before the call to the lower debug print
function. This provides a small performance improvement.

Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent ad5a06f2
Loading
Loading
Loading
Loading
+78 −40
Original line number Diff line number Diff line
@@ -166,11 +166,9 @@ acpi_debug_print(u32 requested_debug_level,
	acpi_thread_id thread_id;
	va_list args;

	/*
	 * Stay silent if the debug level or component ID is disabled
	 */
	if (!(requested_debug_level & acpi_dbg_level) ||
	    !(component_id & acpi_dbg_layer)) {
	/* Check if debug output enabled */

	if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) {
		return;
	}

@@ -236,8 +234,9 @@ acpi_debug_print_raw(u32 requested_debug_level,
{
	va_list args;

	if (!(requested_debug_level & acpi_dbg_level) ||
	    !(component_id & acpi_dbg_layer)) {
	/* Check if debug output enabled */

	if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) {
		return;
	}

@@ -272,9 +271,13 @@ acpi_ut_trace(u32 line_number,
	acpi_gbl_nesting_level++;
	acpi_ut_track_stack_ptr();

	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		acpi_debug_print(ACPI_LV_FUNCTIONS,
			 line_number, function_name, module_name, component_id,
			 "%s\n", acpi_gbl_fn_entry_str);
				 line_number, function_name, module_name,
				 component_id, "%s\n", acpi_gbl_fn_entry_str);
	}
}

ACPI_EXPORT_SYMBOL(acpi_ut_trace)
@@ -304,9 +307,14 @@ acpi_ut_trace_ptr(u32 line_number,
	acpi_gbl_nesting_level++;
	acpi_ut_track_stack_ptr();

	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		acpi_debug_print(ACPI_LV_FUNCTIONS,
			 line_number, function_name, module_name, component_id,
			 "%s %p\n", acpi_gbl_fn_entry_str, pointer);
				 line_number, function_name, module_name,
				 component_id, "%s %p\n", acpi_gbl_fn_entry_str,
				 pointer);
	}
}

/*******************************************************************************
@@ -335,9 +343,14 @@ acpi_ut_trace_str(u32 line_number,
	acpi_gbl_nesting_level++;
	acpi_ut_track_stack_ptr();

	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		acpi_debug_print(ACPI_LV_FUNCTIONS,
			 line_number, function_name, module_name, component_id,
			 "%s %s\n", acpi_gbl_fn_entry_str, string);
				 line_number, function_name, module_name,
				 component_id, "%s %s\n", acpi_gbl_fn_entry_str,
				 string);
	}
}

/*******************************************************************************
@@ -366,9 +379,14 @@ acpi_ut_trace_u32(u32 line_number,
	acpi_gbl_nesting_level++;
	acpi_ut_track_stack_ptr();

	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		acpi_debug_print(ACPI_LV_FUNCTIONS,
			 line_number, function_name, module_name, component_id,
			 "%s %08X\n", acpi_gbl_fn_entry_str, integer);
				 line_number, function_name, module_name,
				 component_id, "%s %08X\n",
				 acpi_gbl_fn_entry_str, integer);
	}
}

/*******************************************************************************
@@ -393,9 +411,13 @@ acpi_ut_exit(u32 line_number,
	     const char *module_name, u32 component_id)
{

	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		acpi_debug_print(ACPI_LV_FUNCTIONS,
			 line_number, function_name, module_name, component_id,
			 "%s\n", acpi_gbl_fn_exit_str);
				 line_number, function_name, module_name,
				 component_id, "%s\n", acpi_gbl_fn_exit_str);
	}

	acpi_gbl_nesting_level--;
}
@@ -425,18 +447,24 @@ acpi_ut_status_exit(u32 line_number,
		    u32 component_id, acpi_status status)
{

	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		if (ACPI_SUCCESS(status)) {
			acpi_debug_print(ACPI_LV_FUNCTIONS,
				 line_number, function_name, module_name,
				 component_id, "%s %s\n", acpi_gbl_fn_exit_str,
					 line_number, function_name,
					 module_name, component_id, "%s %s\n",
					 acpi_gbl_fn_exit_str,
					 acpi_format_exception(status));
		} else {
			acpi_debug_print(ACPI_LV_FUNCTIONS,
				 line_number, function_name, module_name,
				 component_id, "%s ****Exception****: %s\n",
					 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--;
}
@@ -465,10 +493,15 @@ acpi_ut_value_exit(u32 line_number,
		   const char *module_name, u32 component_id, u64 value)
{

	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		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,
				 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--;
}
@@ -497,9 +530,14 @@ acpi_ut_ptr_exit(u32 line_number,
		 const char *module_name, u32 component_id, u8 *ptr)
{

	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		acpi_debug_print(ACPI_LV_FUNCTIONS,
			 line_number, function_name, module_name, component_id,
			 "%s %p\n", acpi_gbl_fn_exit_str, ptr);
				 line_number, function_name, module_name,
				 component_id, "%s %p\n", acpi_gbl_fn_exit_str,
				 ptr);
	}

	acpi_gbl_nesting_level--;
}