summaryrefslogtreecommitdiff
path: root/include/linux/ftrace.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ftrace.h')
-rw-r--r--include/linux/ftrace.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 1c9cdca02580..1cc8ca453a9b 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -225,6 +225,27 @@ extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr);
#ifdef CONFIG_TRACE_BPRINTK
extern int trace_vbprintk(unsigned long ip, const char *fmt, va_list args);
+extern int __trace_bprintk(unsigned long ip, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+
+static inline void ____trace_bprintk_check_format(const char *fmt, ...)
+ __attribute__ ((format (printf, 1, 2)));
+static inline void ____trace_bprintk_check_format(const char *fmt, ...) {}
+#define __trace_bprintk_check_format(fmt, args...) \
+do { \
+ if (0) \
+ ____trace_bprintk_check_format(fmt, ##args); \
+} while (0)
+
+#define trace_bprintk(fmt, args...) \
+do { \
+ static char *__attribute__((section("__trace_bprintk_fmt"))) \
+ trace_bprintk_fmt = fmt; \
+ __trace_bprintk_check_format(fmt, ##args); \
+ __trace_bprintk(_THIS_IP_, trace_bprintk_fmt, ##args); \
+} while (0)
+#else
+#define trace_bprintk trace_printk
#endif
/* May be defined in arch */