提交 00b55864 编写于 作者: J Joe Perches 提交者: Linus Torvalds

dynamic_debug.h/kernel.h: Remove KBUILD_MODNAME from dynamic_pr_debug

If CONFIG_DYNAMIC_DEBUG is enabled and a source file has:

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>

dynamic_debug.h will duplicate KBUILD_MODNAME
in the output string.

Remove the use of KBUILD_MODNAME from the
output format string generated by dynamic_debug.h

If CONFIG_DYNAMIC_DEBUG is not enabled, no compile-time
check is done to printk/dev_printk arguments.

Add it.
Signed-off-by: NJoe Perches <joe@perches.com>
Cc: Jason Baron <jbaron@redhat.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 42f247c8
...@@ -57,8 +57,7 @@ extern int ddebug_remove_module(char *mod_name); ...@@ -57,8 +57,7 @@ extern int ddebug_remove_module(char *mod_name);
{ KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
if (__dynamic_dbg_enabled(descriptor)) \ if (__dynamic_dbg_enabled(descriptor)) \
printk(KERN_DEBUG KBUILD_MODNAME ":" pr_fmt(fmt), \ printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
##__VA_ARGS__); \
} while (0) } while (0)
...@@ -69,9 +68,7 @@ extern int ddebug_remove_module(char *mod_name); ...@@ -69,9 +68,7 @@ extern int ddebug_remove_module(char *mod_name);
{ KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
if (__dynamic_dbg_enabled(descriptor)) \ if (__dynamic_dbg_enabled(descriptor)) \
dev_printk(KERN_DEBUG, dev, \ dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
KBUILD_MODNAME ": " fmt, \
##__VA_ARGS__); \
} while (0) } while (0)
#else #else
...@@ -81,8 +78,10 @@ static inline int ddebug_remove_module(char *mod) ...@@ -81,8 +78,10 @@ static inline int ddebug_remove_module(char *mod)
return 0; return 0;
} }
#define dynamic_pr_debug(fmt, ...) do { } while (0) #define dynamic_pr_debug(fmt, ...) \
#define dynamic_dev_dbg(dev, format, ...) do { } while (0) do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
#define dynamic_dev_dbg(dev, format, ...) \
do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0)
#endif #endif
#endif #endif
...@@ -397,9 +397,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte) ...@@ -397,9 +397,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#elif defined(CONFIG_DYNAMIC_DEBUG) #elif defined(CONFIG_DYNAMIC_DEBUG)
/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
#define pr_debug(fmt, ...) do { \ #define pr_debug(fmt, ...) \
dynamic_pr_debug(fmt, ##__VA_ARGS__); \ dynamic_pr_debug(fmt, ##__VA_ARGS__)
} while (0)
#else #else
#define pr_debug(fmt, ...) \ #define pr_debug(fmt, ...) \
({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册