mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 22:37:45 -04:00
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 <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
1 parent
ef16dd0c2a
commit
069f0cd00d
1 file changed
+12
-5
+12
-5
@@ -108,11 +108,14 @@ struct va_format {
|
||||
* Dummy printk for disabled debugging statements to use whilst maintaining
|
||||
* gcc's format checking.
|
||||
*/
|
||||
#define no_printk(fmt, ...) \
|
||||
do { \
|
||||
if (0) \
|
||||
printk(fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#define no_printk(fmt, ...) \
|
||||
({ \
|
||||
do { \
|
||||
if (0) \
|
||||
printk(fmt, ##__VA_ARGS__); \
|
||||
} while (0); \
|
||||
0; \
|
||||
})
|
||||
|
||||
#ifdef CONFIG_EARLY_PRINTK
|
||||
extern asmlinkage __printf(1, 2)
|
||||
@@ -309,20 +312,24 @@ extern asmlinkage void dump_stack(void) __cold;
|
||||
#define printk_once(fmt, ...) \
|
||||
({ \
|
||||
static bool __print_once __read_mostly; \
|
||||
bool __ret_print_once = !__print_once; \
|
||||
\
|
||||
if (!__print_once) { \
|
||||
__print_once = true; \
|
||||
printk(fmt, ##__VA_ARGS__); \
|
||||
} \
|
||||
unlikely(__ret_print_once); \
|
||||
})
|
||||
#define printk_deferred_once(fmt, ...) \
|
||||
({ \
|
||||
static bool __print_once __read_mostly; \
|
||||
bool __ret_print_once = !__print_once; \
|
||||
\
|
||||
if (!__print_once) { \
|
||||
__print_once = true; \
|
||||
printk_deferred(fmt, ##__VA_ARGS__); \
|
||||
} \
|
||||
unlikely(__ret_print_once); \
|
||||
})
|
||||
#else
|
||||
#define printk_once(fmt, ...) \
|
||||
|
||||
Reference in new issue
Block a user