]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-generic/bug.h
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee13...
[linux-2.6-omap-h63xx.git] / include / asm-generic / bug.h
index 1a565a9d2fa72f0860fb4496eb2454f88b1e4556..1d9573cf4a0bd043ce1cfb9e9190b35e3ea435b1 100644 (file)
@@ -2,7 +2,6 @@
 #define _ASM_GENERIC_BUG_H
 
 #include <linux/compiler.h>
-#include <linux/config.h>
 
 #ifdef CONFIG_BUG
 #ifndef HAVE_ARCH_BUG
 #endif
 
 #ifndef HAVE_ARCH_WARN_ON
-#define WARN_ON(condition) do { \
-       if (unlikely((condition)!=0)) { \
-               printk("BUG: warning at %s:%d/%s()\n", __FILE__, __LINE__, __FUNCTION__); \
-               dump_stack(); \
-       } \
-} while (0)
+#define WARN_ON(condition) ({                                          \
+       typeof(condition) __ret_warn_on = (condition);                  \
+       if (unlikely(__ret_warn_on)) {                                  \
+               printk("BUG: warning at %s:%d/%s()\n", __FILE__,        \
+                       __LINE__, __FUNCTION__);                        \
+               dump_stack();                                           \
+       }                                                               \
+       unlikely(__ret_warn_on);                                        \
+})
 #endif
 
 #else /* !CONFIG_BUG */
 #endif
 
 #ifndef HAVE_ARCH_WARN_ON
-#define WARN_ON(condition) do { if (condition) ; } while(0)
+#define WARN_ON(condition) unlikely((condition))
+#endif
 #endif
+
+#define WARN_ON_ONCE(condition)        ({                              \
+       static int __warned;                                    \
+       typeof(condition) __ret_warn_once = (condition);        \
+                                                               \
+       if (unlikely(__ret_warn_once))                          \
+               if (WARN_ON(!__warned))                         \
+                       __warned = 1;                           \
+       unlikely(__ret_warn_once);                              \
+})
+
+#ifdef CONFIG_SMP
+# define WARN_ON_SMP(x)                        WARN_ON(x)
+#else
+# define WARN_ON_SMP(x)                        do { } while (0)
 #endif
 
 #endif