summaryrefslogtreecommitdiff
path: root/include/acpi/acoutput.h
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2013-03-08 09:22:23 +0000
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-03-12 00:45:04 +0100
commitfd1af7126fb62688cfcf4b563c73b2909ac30f74 (patch)
treef3f1437c28c49da167389868ab047fa43b2eefa1 /include/acpi/acoutput.h
parentc39660b232c5e4aee3cded5a02d28e71ca447fb8 (diff)
downloadlinux-rpi-fd1af7126fb62688cfcf4b563c73b2909ac30f74.tar.gz
linux-rpi-fd1af7126fb62688cfcf4b563c73b2909ac30f74.tar.bz2
linux-rpi-fd1af7126fb62688cfcf4b563c73b2909ac30f74.zip
ACPICA: Regression fix: reinstate safe exit macros
Removal caused a regression on at least FreeBSD. This fix reinstates the macros. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/acpi/acoutput.h')
-rw-r--r--include/acpi/acoutput.h53
1 files changed, 41 insertions, 12 deletions
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 9885276178e0..4f52ea795c7a 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -324,9 +324,9 @@
/* Helper macro */
-#define ACPI_TRACE_ENTRY(name, function, cast, param) \
+#define ACPI_TRACE_ENTRY(name, function, type, param) \
ACPI_FUNCTION_NAME (name) \
- function (ACPI_DEBUG_PARAMETERS, cast (param))
+ function (ACPI_DEBUG_PARAMETERS, (type) (param))
/* The actual entry trace macros */
@@ -335,13 +335,13 @@
acpi_ut_trace (ACPI_DEBUG_PARAMETERS)
#define ACPI_FUNCTION_TRACE_PTR(name, pointer) \
- ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, (void *), pointer)
+ ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, void *, pointer)
#define ACPI_FUNCTION_TRACE_U32(name, value) \
- ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, (u32), value)
+ ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, u32, value)
#define ACPI_FUNCTION_TRACE_STR(name, string) \
- ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, (char *), string)
+ ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, char *, string)
#define ACPI_FUNCTION_ENTRY() \
acpi_ut_track_stack_ptr()
@@ -355,16 +355,37 @@
*
* One of the FUNCTION_TRACE macros above must be used in conjunction
* with these macros so that "_AcpiFunctionName" is defined.
+ *
+ * There are two versions of most of the return macros. The default version is
+ * safer, since it avoids side-effects by guaranteeing that the argument will
+ * not be evaluated twice.
+ *
+ * A less-safe version of the macros is provided for optional use if the
+ * compiler uses excessive CPU stack (for example, this may happen in the
+ * debug case if code optimzation is disabled.)
*/
/* Exit trace helper macro */
-#define ACPI_TRACE_EXIT(function, cast, param) \
+#ifndef ACPI_SIMPLE_RETURN_MACROS
+
+#define ACPI_TRACE_EXIT(function, type, param) \
+ ACPI_DO_WHILE0 ({ \
+ register type _param = (type) (param); \
+ function (ACPI_DEBUG_PARAMETERS, _param); \
+ return (_param); \
+ })
+
+#else /* Use original less-safe macros */
+
+#define ACPI_TRACE_EXIT(function, type, param) \
ACPI_DO_WHILE0 ({ \
- function (ACPI_DEBUG_PARAMETERS, cast (param)); \
- return ((param)); \
+ function (ACPI_DEBUG_PARAMETERS, (type) (param)); \
+ return (param); \
})
+#endif /* ACPI_SIMPLE_RETURN_MACROS */
+
/* The actual exit macros */
#define return_VOID \
@@ -374,13 +395,19 @@
})
#define return_ACPI_STATUS(status) \
- ACPI_TRACE_EXIT (acpi_ut_status_exit, (acpi_status), status)
+ ACPI_TRACE_EXIT (acpi_ut_status_exit, acpi_status, status)
#define return_PTR(pointer) \
- ACPI_TRACE_EXIT (acpi_ut_ptr_exit, (u8 *), pointer)
+ ACPI_TRACE_EXIT (acpi_ut_ptr_exit, void *, pointer)
#define return_VALUE(value) \
- ACPI_TRACE_EXIT (acpi_ut_value_exit, (u64), value)
+ ACPI_TRACE_EXIT (acpi_ut_value_exit, u64, value)
+
+#define return_UINT32(value) \
+ ACPI_TRACE_EXIT (acpi_ut_value_exit, u32, value)
+
+#define return_UINT8(value) \
+ ACPI_TRACE_EXIT (acpi_ut_value_exit, u8, value)
/* Conditional execution */
@@ -428,8 +455,10 @@
#define return_VOID return
#define return_ACPI_STATUS(s) return(s)
-#define return_VALUE(s) return(s)
#define return_PTR(s) return(s)
+#define return_VALUE(s) return(s)
+#define return_UINT8(s) return(s)
+#define return_UINT32(s) return(s)
#endif /* ACPI_DEBUG_OUTPUT */