aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJohn Stultz <[email protected]>2014-06-04 16:11:41 -0700
committerLinus Torvalds <[email protected]>2014-06-04 16:54:17 -0700
commitc224815dac9c739b79050d3cc67443ff500bc478 (patch)
tree07cca4568dd1ae0c89241c1b335a1941ec2bca85 /include/linux
parentaac74dc495456412c4130a1167ce4beb6c1f0b38 (diff)
printk: Add printk_deferred_once
Two of the three prink_deferred uses are really printk_once style uses, so add a printk_deferred_once macro to simplify those call sites. Signed-off-by: John Stultz <[email protected]> Reviewed-by: Steven Rostedt <[email protected]> Reviewed-by: Jan Kara <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Jiri Bohac <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/printk.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 7847301e2837..f086d6c99dbc 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -266,9 +266,20 @@ extern asmlinkage void dump_stack(void) __cold;
printk(fmt, ##__VA_ARGS__); \
} \
})
+#define printk_deferred_once(fmt, ...) \
+({ \
+ static bool __print_once __read_mostly; \
+ \
+ if (!__print_once) { \
+ __print_once = true; \
+ printk_deferred(fmt, ##__VA_ARGS__); \
+ } \
+})
#else
#define printk_once(fmt, ...) \
no_printk(fmt, ##__VA_ARGS__)
+#define printk_deferred_once(fmt, ...) \
+ no_printk(fmt, ##__VA_ARGS__)
#endif
#define pr_emerg_once(fmt, ...) \