Skip to content

Commit

Permalink
[PATCH] introduce WARN_ON_ONCE(cond)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Jun 25, 2006
1 parent 6975565 commit 74bb6a0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/asm-generic/bug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 74bb6a0

Please sign in to comment.