diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 30769f724..792b28a90 100755 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -593,6 +593,9 @@ do { \ * let gcc optimize the rest. */ +#ifdef CONFIG_DISABLE_TRACE_PRINTK +#define trace_printk pr_debug +#else #define trace_printk(fmt, ...) \ do { \ char _______STR[] = __stringify((__VA_ARGS__)); \ @@ -615,6 +618,7 @@ do { \ else \ __trace_printk(_THIS_IP_, fmt, ##args); \ } while (0) +#endif extern __printf(2, 3) int __trace_bprintk(unsigned long ip, const char *fmt, ...); diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 1953f7ed9..bb7d3e2eb 100755 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig @@ -149,6 +149,20 @@ config GENERIC_TRACER bool select TRACING +if TRACING + +config DISABLE_TRACE_PRINTK + bool "Force disable trace_printk() usage" + default y + help + When trace_printk() is used in any of the kernel source, it enables + debugging functions which are not desired for production kernel. + Enabling this option will replace trace_printk() with pr_debug(). + + If in doubt, say Y. + +endif + # # Minimum requirements an architecture has to meet for us to # be able to offer generic tracing facilities: