diff mbox

[v1,6/7] acpi: Remove dependency on __LINE__ for release builds

Message ID 1462549688-29263-7-git-send-email-ross.lagerwall@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ross Lagerwall May 6, 2016, 3:48 p.m. UTC
When using xsplice, use of __LINE__ can generate spurious changes in
functions due to embedded line numbers.  For release builds, remove the
use of these line numbers in the ACPI code and print the current text
address instead.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 xen/drivers/acpi/utilities/utmisc.c | 46 +++++++++++++++++++++++++++++++++++++
 xen/include/acpi/acmacros.h         |  4 ++++
 xen/include/acpi/acutils.h          | 19 +++++++++++++++
 3 files changed, 69 insertions(+)

Comments

Jan Beulich May 10, 2016, 2:52 p.m. UTC | #1
>>> On 06.05.16 at 17:48, <ross.lagerwall@citrix.com> wrote:
> --- a/xen/drivers/acpi/utilities/utmisc.c
> +++ b/xen/drivers/acpi/utilities/utmisc.c
> @@ -134,6 +134,51 @@ const char *__init acpi_ut_validate_exception(acpi_status status)
>  *
>  ******************************************************************************/
>  
> +#ifdef NDEBUG
> +void ACPI_INTERNAL_VAR_XFACE __init
> +acpi_ut_error(const char *module_name, void *addr, char *format, ...)
> +{
> +	va_list args;
> +
> +	acpi_os_printf("ACPI Error (%s-%p): ", module_name, addr);
> +
> +	va_start(args, format);
> +	acpi_os_vprintf(format, args);
> +	acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
> +	va_end(args);
> +}
> +
> +void ACPI_INTERNAL_VAR_XFACE __init
> +acpi_ut_warning(const char *module_name, void *addr, char *format, ...)
> +{
> +	va_list args;
> +
> +	acpi_os_printf("ACPI Warning (%s-%p): ", module_name, addr);
> +
> +	va_start(args, format);
> +	acpi_os_vprintf(format, args);
> +	acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
> +	va_end(args);
> +	va_end(args);
> +}
> +
> +void ACPI_INTERNAL_VAR_XFACE __init
> +acpi_ut_info(const char *module_name, void *addr, char *format, ...)
> +{
> +	va_list args;
> +
> +	/*
> +	 * Removed module_name, line_number, and acpica version, not needed
> +	 * for info output
> +	 */
> +	acpi_os_printf("ACPI: ");
> +
> +	va_start(args, format);
> +	acpi_os_vprintf(format, args);
> +	acpi_os_printf("\n");
> +	va_end(args);
> +}
> +#else
>  void ACPI_INTERNAL_VAR_XFACE __init
>  acpi_ut_error(const char *module_name, u32 line_number, char *format, ...)
>  {

This is all __init code, runtime patching of which makes no sense
anyway (as it's gone by the time a patch can get applied), so
this patch seems pointless. And if it was nevertheless needed for
a reason I overlook right now, it's way too much redundant code
that gets added, i.e. proper abstraction to limit the impact would
be necessary.

Jan

Jan
diff mbox

Patch

diff --git a/xen/drivers/acpi/utilities/utmisc.c b/xen/drivers/acpi/utilities/utmisc.c
index b3e3012..8ace116 100644
--- a/xen/drivers/acpi/utilities/utmisc.c
+++ b/xen/drivers/acpi/utilities/utmisc.c
@@ -134,6 +134,51 @@  const char *__init acpi_ut_validate_exception(acpi_status status)
  *
  ******************************************************************************/
 
+#ifdef NDEBUG
+void ACPI_INTERNAL_VAR_XFACE __init
+acpi_ut_error(const char *module_name, void *addr, char *format, ...)
+{
+	va_list args;
+
+	acpi_os_printf("ACPI Error (%s-%p): ", module_name, addr);
+
+	va_start(args, format);
+	acpi_os_vprintf(format, args);
+	acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
+	va_end(args);
+}
+
+void ACPI_INTERNAL_VAR_XFACE __init
+acpi_ut_warning(const char *module_name, void *addr, char *format, ...)
+{
+	va_list args;
+
+	acpi_os_printf("ACPI Warning (%s-%p): ", module_name, addr);
+
+	va_start(args, format);
+	acpi_os_vprintf(format, args);
+	acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
+	va_end(args);
+	va_end(args);
+}
+
+void ACPI_INTERNAL_VAR_XFACE __init
+acpi_ut_info(const char *module_name, void *addr, char *format, ...)
+{
+	va_list args;
+
+	/*
+	 * Removed module_name, line_number, and acpica version, not needed
+	 * for info output
+	 */
+	acpi_os_printf("ACPI: ");
+
+	va_start(args, format);
+	acpi_os_vprintf(format, args);
+	acpi_os_printf("\n");
+	va_end(args);
+}
+#else
 void ACPI_INTERNAL_VAR_XFACE __init
 acpi_ut_error(const char *module_name, u32 line_number, char *format, ...)
 {
@@ -177,3 +222,4 @@  acpi_ut_info(const char *module_name, u32 line_number, char *format, ...)
 	acpi_os_printf("\n");
 	va_end(args);
 }
+#endif
diff --git a/xen/include/acpi/acmacros.h b/xen/include/acpi/acmacros.h
index 6765535..d8a2a14 100644
--- a/xen/include/acpi/acmacros.h
+++ b/xen/include/acpi/acmacros.h
@@ -422,7 +422,11 @@ 
  * Ascii error messages can be configured out
  */
 #ifndef ACPI_NO_ERROR_MESSAGES
+#ifdef NDEBUG
+#define AE_INFO                         _acpi_module_name, current_text_addr()
+#else
 #define AE_INFO                         _acpi_module_name, __LINE__
+#endif
 
 /*
  * Error reporting. Callers module and line number are inserted by AE_INFO,
diff --git a/xen/include/acpi/acutils.h b/xen/include/acpi/acutils.h
index b1b0df7..708256d 100644
--- a/xen/include/acpi/acutils.h
+++ b/xen/include/acpi/acutils.h
@@ -174,6 +174,24 @@  acpi_ut_debug_print_raw(u32 requested_debug_level,
 			u32 component_id,
 			char *format, ...) ACPI_PRINTF_LIKE(6);
 
+#ifdef NDEBUG
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_error(const char *module_name,
+	      void *addr, char *format, ...) ACPI_PRINTF_LIKE(3);
+
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_exception(const char *module_name,
+		  void *addr,
+		  acpi_status status, char *format, ...) ACPI_PRINTF_LIKE(4);
+
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_warning(const char *module_name,
+		void *addr, char *format, ...) ACPI_PRINTF_LIKE(3);
+
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_info(const char *module_name,
+	     void *addr, char *format, ...) ACPI_PRINTF_LIKE(3);
+#else
 void ACPI_INTERNAL_VAR_XFACE
 acpi_ut_error(const char *module_name,
 	      u32 line_number, char *format, ...) ACPI_PRINTF_LIKE(3);
@@ -190,6 +208,7 @@  acpi_ut_warning(const char *module_name,
 void ACPI_INTERNAL_VAR_XFACE
 acpi_ut_info(const char *module_name,
 	     u32 line_number, char *format, ...) ACPI_PRINTF_LIKE(3);
+#endif
 
 /*
  * utmisc