diff options
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r-- | include/linux/kernel.h | 40 |
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...) \ |
454 | do { \ | 454 | do { \ |
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 | ||
465 | extern int | 466 | extern int |
467 | __trace_bprintk(unsigned long ip, const char *fmt, ...) | ||
468 | __attribute__ ((format (printf, 2, 3))); | ||
469 | |||
470 | extern 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) \ |
470 | do { \ | 480 | do { \ |
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 | ||
480 | extern int | 491 | extern int |
492 | __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap); | ||
493 | |||
494 | extern 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 | ||
483 | extern void ftrace_dump(void); | 497 | extern void ftrace_dump(void); |