From: Ingo Molnar Date: Sun, 25 Jun 2006 12:48:09 +0000 (-0700) Subject: [PATCH] introduce WARN_ON_ONCE(cond) X-Git-Tag: v2.6.18-rc1~967 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74bb6a09b2e1e69d91eb6069eb4a7f0c06b84812;p=linux-2.6 [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 Signed-off-by: Arjan van de Ven Signed-off-by: Steven Rostedt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 0cd9711895..845cb67ad8 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