aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/printk.h
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2016-07-04 18:31:26 -0400
committerIngo Molnar <mingo@kernel.org>2016-07-08 05:33:18 -0400
commit069f0cd00df0abfb9252e0dbdc355e40e6ab75fc (patch)
treea86d2acab5de6d9eb06c9325e883ec8f75d00ef2 /include/linux/printk.h
parentef16dd0c2a523d2e3975bb1bea9f5727e3e7146f (diff)
printk: Make the printk*once() variants return a value
Have printk*once() return a bool which denotes whether the string was printed or not so that calling code can react accordingly. Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1467671487-10344-3-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/printk.h')
-rw-r--r--include/linux/printk.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/include/linux/printk.h b/include/linux/printk.h
index f4da695fd615..f136b22c7772 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -108,11 +108,14 @@ struct va_format {
108 * Dummy printk for disabled debugging statements to use whilst maintaining 108 * Dummy printk for disabled debugging statements to use whilst maintaining
109 * gcc's format checking. 109 * gcc's format checking.
110 */ 110 */
111#define no_printk(fmt, ...) \ 111#define no_printk(fmt, ...) \
112do { \ 112({ \
113 if (0) \ 113 do { \
114 printk(fmt, ##__VA_ARGS__); \ 114 if (0) \
115} while (0) 115 printk(fmt, ##__VA_ARGS__); \
116 } while (0); \
117 0; \
118})
116 119
117#ifdef CONFIG_EARLY_PRINTK 120#ifdef CONFIG_EARLY_PRINTK
118extern asmlinkage __printf(1, 2) 121extern asmlinkage __printf(1, 2)
@@ -309,20 +312,24 @@ extern asmlinkage void dump_stack(void) __cold;
309#define printk_once(fmt, ...) \ 312#define printk_once(fmt, ...) \
310({ \ 313({ \
311 static bool __print_once __read_mostly; \ 314 static bool __print_once __read_mostly; \
315 bool __ret_print_once = !__print_once; \
312 \ 316 \
313 if (!__print_once) { \ 317 if (!__print_once) { \
314 __print_once = true; \ 318 __print_once = true; \
315 printk(fmt, ##__VA_ARGS__); \ 319 printk(fmt, ##__VA_ARGS__); \
316 } \ 320 } \
321 unlikely(__ret_print_once); \
317}) 322})
318#define printk_deferred_once(fmt, ...) \ 323#define printk_deferred_once(fmt, ...) \
319({ \ 324({ \
320 static bool __print_once __read_mostly; \ 325 static bool __print_once __read_mostly; \
326 bool __ret_print_once = !__print_once; \
321 \ 327 \
322 if (!__print_once) { \ 328 if (!__print_once) { \
323 __print_once = true; \ 329 __print_once = true; \
324 printk_deferred(fmt, ##__VA_ARGS__); \ 330 printk_deferred(fmt, ##__VA_ARGS__); \
325 } \ 331 } \
332 unlikely(__ret_print_once); \
326}) 333})
327#else 334#else
328#define printk_once(fmt, ...) \ 335#define printk_once(fmt, ...) \