Merge tag 'asm-generic-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd...
[cascardo/linux.git] / include / asm-generic / bug.h
index 58bd1f0..6f96247 100644 (file)
@@ -81,6 +81,12 @@ extern void warn_slowpath_null(const char *file, const int line);
        do { printk(arg); __WARN_TAINT(taint); } while (0)
 #endif
 
+/* used internally by panic.c */
+struct warn_args;
+
+void __warn(const char *file, int line, void *caller, unsigned taint,
+           struct pt_regs *regs, struct warn_args *args);
+
 #ifndef WARN_ON
 #define WARN_ON(condition) ({                                          \
        int __ret_warn_on = !!(condition);                              \
@@ -110,9 +116,10 @@ extern void warn_slowpath_null(const char *file, const int line);
        static bool __section(.data.unlikely) __warned;         \
        int __ret_warn_once = !!(condition);                    \
                                                                \
-       if (unlikely(__ret_warn_once))                          \
-               if (WARN_ON(!__warned))                         \
-                       __warned = true;                        \
+       if (unlikely(__ret_warn_once && !__warned)) {           \
+               __warned = true;                                \
+               WARN_ON(1);                                     \
+       }                                                       \
        unlikely(__ret_warn_once);                              \
 })
 
@@ -120,9 +127,10 @@ extern void warn_slowpath_null(const char *file, const int line);
        static bool __section(.data.unlikely) __warned;         \
        int __ret_warn_once = !!(condition);                    \
                                                                \
-       if (unlikely(__ret_warn_once))                          \
-               if (WARN(!__warned, format))                    \
-                       __warned = true;                        \
+       if (unlikely(__ret_warn_once && !__warned)) {           \
+               __warned = true;                                \
+               WARN(1, format);                                \
+       }                                                       \
        unlikely(__ret_warn_once);                              \
 })
 
@@ -130,9 +138,10 @@ extern void warn_slowpath_null(const char *file, const int line);
        static bool __section(.data.unlikely) __warned;         \
        int __ret_warn_once = !!(condition);                    \
                                                                \
-       if (unlikely(__ret_warn_once))                          \
-               if (WARN_TAINT(!__warned, taint, format))       \
-                       __warned = true;                        \
+       if (unlikely(__ret_warn_once && !__warned)) {           \
+               __warned = true;                                \
+               WARN_TAINT(1, taint, format);                   \
+       }                                                       \
        unlikely(__ret_warn_once);                              \
 })