mirror of https://gitee.com/openkylin/linux.git
[PATCH] introduce WARN_ON_ONCE(cond)
Add WARN_ON_ONCE(cond) to print once-per-bootup messages. [rostedt@goodmis.org: improve code generation] Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
69755652c9
commit
74bb6a09b2
|
@ -38,4 +38,17 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#define WARN_ON_ONCE(condition) \
|
||||
({ \
|
||||
static int __warn_once = 1; \
|
||||
int __ret = 0; \
|
||||
\
|
||||
if (unlikely((condition) && __warn_once)) { \
|
||||
__warn_once = 0; \
|
||||
WARN_ON(1); \
|
||||
__ret = 1; \
|
||||
} \
|
||||
__ret; \
|
||||
})
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue