aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h40
1 files changed, 27 insertions, 13 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 7742798c9208..1daca3b062bb 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -452,32 +452,46 @@ do { \
452 452
453#define trace_printk(fmt, args...) \ 453#define trace_printk(fmt, args...) \
454do { \ 454do { \
455 static const char *trace_printk_fmt \
456 __attribute__((section("__trace_printk_fmt"))); \
457 \
458 if (!trace_printk_fmt) \
459 trace_printk_fmt = fmt; \
460 \
461 __trace_printk_check_format(fmt, ##args); \ 455 __trace_printk_check_format(fmt, ##args); \
462 __trace_printk(_THIS_IP_, trace_printk_fmt, ##args); \ 456 if (__builtin_constant_p(fmt)) { \
457 static const char *trace_printk_fmt \
458 __attribute__((section("__trace_printk_fmt"))) = \
459 __builtin_constant_p(fmt) ? fmt : NULL; \
460 \
461 __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \
462 } else \
463 __trace_printk(_THIS_IP_, fmt, ##args); \
463} while (0) 464} while (0)
464 465
465extern int 466extern int
467__trace_bprintk(unsigned long ip, const char *fmt, ...)
468 __attribute__ ((format (printf, 2, 3)));
469
470extern int
466__trace_printk(unsigned long ip, const char *fmt, ...) 471__trace_printk(unsigned long ip, const char *fmt, ...)
467 __attribute__ ((format (printf, 2, 3))); 472 __attribute__ ((format (printf, 2, 3)));
468 473
474/*
475 * The double __builtin_constant_p is because gcc will give us an error
476 * if we try to allocate the static variable to fmt if it is not a
477 * constant. Even with the outer if statement.
478 */
469#define ftrace_vprintk(fmt, vargs) \ 479#define ftrace_vprintk(fmt, vargs) \
470do { \ 480do { \
471 static const char *trace_printk_fmt \ 481 if (__builtin_constant_p(fmt)) { \
472 __attribute__((section("__trace_printk_fmt"))); \ 482 static const char *trace_printk_fmt \
473 \ 483 __attribute__((section("__trace_printk_fmt"))) = \
474 if (!trace_printk_fmt) \ 484 __builtin_constant_p(fmt) ? fmt : NULL; \
475 trace_printk_fmt = fmt; \
476 \ 485 \
477 __ftrace_vprintk(_THIS_IP_, trace_printk_fmt, vargs); \ 486 __ftrace_vbprintk(_THIS_IP_, trace_printk_fmt, vargs); \
487 } else \
488 __ftrace_vprintk(_THIS_IP_, fmt, vargs); \
478} while (0) 489} while (0)
479 490
480extern int 491extern int
492__ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap);
493
494extern int
481__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); 495__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
482 496
483extern void ftrace_dump(void); 497extern void ftrace_dump(void);