[03/10] linux/printk.h: use unique identifier for each struct _ddebug
diff mbox series

Message ID 20190409212517.7321-4-linux@rasmusvillemoes.dk
State In Next
Commit 1c2c9bae778195f10d4a19b172ce9a403f7341c3
Headers show
Series
  • implement DYNAMIC_DEBUG_RELATIVE_POINTERS
Related show

Commit Message

Rasmus Villemoes April 9, 2019, 9:25 p.m. UTC
Changes on x86-64 later in this series require that all struct _ddebug
descriptors in a translation unit uses distinct identifiers. Realize
that for pr_debug_ratelimited by generating such an identifier via
__UNIQUE_ID and pass that to an extra level of macros.

No functional change.

Acked-by: Petr Mladek <pmladek@suse.com>
Acked-by: Jason Baron <jbaron@akamai.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 include/linux/printk.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/include/linux/printk.h b/include/linux/printk.h
index d7c77ed1a4cb..0fcc588db649 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -454,7 +454,7 @@  extern int kptr_restrict;
 /* If you are writing a driver, please use dev_dbg instead */
 #if defined(CONFIG_DYNAMIC_DEBUG)
 /* descriptor check is first to prevent flooding with "callbacks suppressed" */
-#define pr_debug_ratelimited(fmt, ...)					\
+#define _pr_debug_ratelimited(descriptor, fmt, ...)			\
 do {									\
 	static DEFINE_RATELIMIT_STATE(_rs,				\
 				      DEFAULT_RATELIMIT_INTERVAL,	\
@@ -464,6 +464,8 @@  do {									\
 	    __ratelimit(&_rs))						\
 		__dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__);	\
 } while (0)
+#define pr_debug_ratelimited(fmt, ...)		\
+	_pr_debug_ratelimited(__UNIQUE_ID(ddebug), fmt, ##__VA_ARGS__)
 #elif defined(DEBUG)
 #define pr_debug_ratelimited(fmt, ...)					\
 	printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)