summaryrefslogtreecommitdiff
path: root/include/linux/printk.h
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2014-05-22 10:43:36 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2014-05-22 10:43:36 +1000
commit32d0bcf0e688dc5c4dc7e32ad79a0dd2e223e461 (patch)
tree4069cb6782d0d3477c548742a80f18a3619b8dea /include/linux/printk.h
parent17f19ee3ae1619f7e11e0e8b8f31c3241972fd08 (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 <john.stultz@linaro.org> Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Reviewed-by: Jan Kara <jack@suse.cz> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Jiri Bohac <jbohac@suse.cz> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux/printk.h')
-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, ...) \