Skip to content

Commit e6e66b0

Browse files
Greg Banksgregkh
authored andcommitted
Dynamic debug: fix pr_fmt() build error
When CONFIG_DYNAMIC_DEBUG is enabled, allow callers of pr_debug() to provide their own definition of pr_fmt() even if that definition uses tricks like #define pr_fmt(fmt) "%s:" fmt, __func__ Signed-off-by: Greg Banks <gnb@sgi.com> Cc: Jason Baron <jbaron@redhat.com> Acked-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 9898abb commit e6e66b0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

include/linux/dynamic_debug.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ extern int ddebug_remove_module(char *mod_name);
5757
{ KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
5858
DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
5959
if (__dynamic_dbg_enabled(descriptor)) \
60-
printk(KERN_DEBUG KBUILD_MODNAME ":" fmt, \
60+
printk(KERN_DEBUG KBUILD_MODNAME ":" pr_fmt(fmt), \
6161
##__VA_ARGS__); \
6262
} while (0)
6363

@@ -70,7 +70,7 @@ extern int ddebug_remove_module(char *mod_name);
7070
DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
7171
if (__dynamic_dbg_enabled(descriptor)) \
7272
dev_printk(KERN_DEBUG, dev, \
73-
KBUILD_MODNAME ": " fmt, \
73+
KBUILD_MODNAME ": " pr_fmt(fmt),\
7474
##__VA_ARGS__); \
7575
} while (0)
7676

include/linux/kernel.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,9 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
359359
#define pr_debug(fmt, ...) \
360360
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
361361
#elif defined(CONFIG_DYNAMIC_DEBUG)
362+
/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
362363
#define pr_debug(fmt, ...) do { \
363-
dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
364+
dynamic_pr_debug(fmt, ##__VA_ARGS__); \
364365
} while (0)
365366
#else
366367
#define pr_debug(fmt, ...) \

0 commit comments

Comments
 (0)