summaryrefslogtreecommitdiffstats
path: root/include/asm-generic/bug.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-06-25 05:48:09 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 10:01:11 -0700
commit74bb6a09b2e1e69d91eb6069eb4a7f0c06b84812 (patch)
treef55af6ec05bd7f547abf4cf9384e94570076d8c3 /include/asm-generic/bug.h
parent69755652c92106855b4b096b7c2935b59e6252c6 (diff)
downloadtalos-obmc-linux-74bb6a09b2e1e69d91eb6069eb4a7f0c06b84812.tar.gz
talos-obmc-linux-74bb6a09b2e1e69d91eb6069eb4a7f0c06b84812.zip
[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>
Diffstat (limited to 'include/asm-generic/bug.h')
-rw-r--r--include/asm-generic/bug.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 0cd9711895fa..845cb67ad8ea 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -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
OpenPOWER on IntegriCloud