[PATCH] trace: fix undefined tracing functions build error
From: Julien Thierry
Date: Thu Oct 26 2017 - 04:37:57 EST
When selecting CONFIG_PREEMPTIRQ_EVENTS without CONFIG_DEBUG_PREEMPT,
trace_preempt_(en|dis)able_* names do not get defined. This causes a build
error in function trace_preempt_off (kernel/trace/trace_irqsoff.c) when
CONFIG_PREEMPT_TRACER is enabled.
Similarly, when selecting CONFIG_PREEMPTIRQ_EVENTS and
CONFIG_PROVE_LOCKING, trace_irq_(en|dis)able_* names do not get defined,
although it seems they do not get referenced in that configuration.
Ensure trace_(irq|preempt)_* names are always defined, becoming empty
macros in the cases where they were not defined previously.
Signed-off-by: Julien Thierry <julien.thierry@xxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
---
include/trace/events/preemptirq.h | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/trace/events/preemptirq.h b/include/trace/events/preemptirq.h
index f5024c5..9c4eb33 100644
--- a/include/trace/events/preemptirq.h
+++ b/include/trace/events/preemptirq.h
@@ -56,15 +56,18 @@
#include <trace/define_trace.h>
-#else /* !CONFIG_PREEMPTIRQ_EVENTS */
+#endif /* !CONFIG_PREEMPTIRQ_EVENTS */
+#if !defined(CONFIG_PREEMPTIRQ_EVENTS) || defined(CONFIG_PROVE_LOCKING)
#define trace_irq_enable(...)
#define trace_irq_disable(...)
-#define trace_preempt_enable(...)
-#define trace_preempt_disable(...)
#define trace_irq_enable_rcuidle(...)
#define trace_irq_disable_rcuidle(...)
+#endif
+
+#if !defined(CONFIG_PREEMPTIRQ_EVENTS) || !defined(CONFIG_DEBUG_PREEMPT)
+#define trace_preempt_enable(...)
+#define trace_preempt_disable(...)
#define trace_preempt_enable_rcuidle(...)
#define trace_preempt_disable_rcuidle(...)
-
#endif
--
1.9.1