Skip to content

Commit 0381e58

Browse files
geertupmladek
authored andcommitted
dyndbg: Use *no_printk() helpers
When printk-indexing is enabled, each printk() or dev_printk() invocation emits a pi_entry structure. This is even true when the call is protected by an always-false check: while the actual code to print the message is optimized out by the compiler, the pi_entry structure is still emitted. Fix this by replacing "if (0) *printk(...)" constructs by calls to the corresponding *no_printk() helpers. Note that this has minimal impact, as most (all?) callers of dynamic_{pr,dev}_debug() are protected by checks for DYNAMIC_DEBUG anyway. Still, using the helpers serves as a good example to follow. Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Xiubo Li <[email protected]> Reviewed-by: Chris Down <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/32e18ceb528b99d9147be9c1af578a1965e2bad9.1709127473.git.geert+renesas@glider.be Signed-off-by: Petr Mladek <[email protected]>
1 parent c26ec79 commit 0381e58

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/dynamic_debug.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,9 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
305305
#define DYNAMIC_DEBUG_BRANCH(descriptor) false
306306

307307
#define dynamic_pr_debug(fmt, ...) \
308-
do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
308+
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
309309
#define dynamic_dev_dbg(dev, fmt, ...) \
310-
do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0)
310+
dev_no_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__)
311311
#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
312312
groupsize, buf, len, ascii) \
313313
do { if (0) \

0 commit comments

Comments
 (0)