diff options
author | John Stultz <john.stultz@linaro.org> | 2014-06-04 19:11:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-04 19:54:17 -0400 |
commit | c224815dac9c739b79050d3cc67443ff500bc478 (patch) | |
tree | 07cca4568dd1ae0c89241c1b335a1941ec2bca85 /include/linux/printk.h | |
parent | aac74dc495456412c4130a1167ce4beb6c1f0b38 (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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/printk.h')
-rw-r--r-- | include/linux/printk.h | 11 |
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; | |||
266 | printk(fmt, ##__VA_ARGS__); \ | 266 | printk(fmt, ##__VA_ARGS__); \ |
267 | } \ | 267 | } \ |
268 | }) | 268 | }) |
269 | #define printk_deferred_once(fmt, ...) \ | ||
270 | ({ \ | ||
271 | static bool __print_once __read_mostly; \ | ||
272 | \ | ||
273 | if (!__print_once) { \ | ||
274 | __print_once = true; \ | ||
275 | printk_deferred(fmt, ##__VA_ARGS__); \ | ||
276 | } \ | ||
277 | }) | ||
269 | #else | 278 | #else |
270 | #define printk_once(fmt, ...) \ | 279 | #define printk_once(fmt, ...) \ |
271 | no_printk(fmt, ##__VA_ARGS__) | 280 | no_printk(fmt, ##__VA_ARGS__) |
281 | #define printk_deferred_once(fmt, ...) \ | ||
282 | no_printk(fmt, ##__VA_ARGS__) | ||
272 | #endif | 283 | #endif |
273 | 284 | ||
274 | #define pr_emerg_once(fmt, ...) \ | 285 | #define pr_emerg_once(fmt, ...) \ |