diff options
Diffstat (limited to 'include/asm-generic/bug.h')
-rw-r--r-- | include/asm-generic/bug.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 1a565a9d2fa..8ceab7bcd8b 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -2,7 +2,6 @@ #define _ASM_GENERIC_BUG_H #include <linux/compiler.h> -#include <linux/config.h> #ifdef CONFIG_BUG #ifndef HAVE_ARCH_BUG @@ -39,4 +38,23 @@ #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; \ +}) + +#ifdef CONFIG_SMP +# define WARN_ON_SMP(x) WARN_ON(x) +#else +# define WARN_ON_SMP(x) do { } while (0) +#endif + #endif |