Unfortunately this removes the use of .data.unlikely code
section for the warned state...

Signed-off-by: Frederic Weisbecker <fweis...@gmail.com>
Cc: Andrew Morton <a...@linux-foundation.org>
Cc: Steven Rostedt <rost...@goodmis.org>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: H. Peter Anvin <h...@zytor.com>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Liu Chuansheng <chuansheng....@intel.com>
Cc: Ingo Molnar <mi...@kernel.org>
---
 include/asm-generic/bug.h | 57 ++++++++++-------------------------------------
 1 file changed, 12 insertions(+), 45 deletions(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 7d10f96..2663ea1 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -82,29 +82,17 @@ extern void warn_slowpath_null(const char *file, const int 
line);
 #endif
 
 #ifndef WARN_ON
-#define WARN_ON(condition) ({                                          \
-       int __ret_warn_on = !!(condition);                              \
-       if (unlikely(__ret_warn_on))                                    \
-               __WARN();                                               \
-       unlikely(__ret_warn_on);                                        \
-})
+#define WARN_ON(condition)                                             \
+       DO_COND(condition, __WARN())
 #endif
 
 #ifndef WARN
-#define WARN(condition, format...) ({                                          
\
-       int __ret_warn_on = !!(condition);                              \
-       if (unlikely(__ret_warn_on))                                    \
-               __WARN_printf(format);                                  \
-       unlikely(__ret_warn_on);                                        \
-})
+#define WARN(condition, format...)                                     \
+       DO_COND(condition, __WARN_printf(format))
 #endif
 
-#define WARN_TAINT(condition, taint, format...) ({                     \
-       int __ret_warn_on = !!(condition);                              \
-       if (unlikely(__ret_warn_on))                                    \
-               __WARN_printf_taint(taint, format);                     \
-       unlikely(__ret_warn_on);                                        \
-})
+#define WARN_TAINT(condition, taint, format...)                        \
+       DO_COND(condition, __WARN_printf_taint(taint, format))
 
 #else /* !CONFIG_BUG */
 #ifndef HAVE_ARCH_BUG
@@ -133,35 +121,14 @@ extern void warn_slowpath_null(const char *file, const 
int line);
 
 #endif
 
-#define WARN_ON_ONCE(condition)        ({                              \
-       static bool __section(.data.unlikely) __warned;         \
-       int __ret_warn_once = !!(condition);                    \
-                                                               \
-       if (unlikely(__ret_warn_once))                          \
-               if (WARN_ON(!__warned))                         \
-                       __warned = true;                        \
-       unlikely(__ret_warn_once);                              \
-})
+#define WARN_ON_ONCE(condition)                                        \
+       DO_ONCE_COND(condition, __WARN())
 
-#define WARN_ONCE(condition, format...)        ({                      \
-       static bool __section(.data.unlikely) __warned;         \
-       int __ret_warn_once = !!(condition);                    \
-                                                               \
-       if (unlikely(__ret_warn_once))                          \
-               if (WARN(!__warned, format))                    \
-                       __warned = true;                        \
-       unlikely(__ret_warn_once);                              \
-})
+#define WARN_ONCE(condition, format...)                                \
+       DO_ONCE_COND(condition, __WARN_printf(format))
 
-#define WARN_TAINT_ONCE(condition, taint, format...)   ({      \
-       static bool __section(.data.unlikely) __warned;         \
-       int __ret_warn_once = !!(condition);                    \
-                                                               \
-       if (unlikely(__ret_warn_once))                          \
-               if (WARN_TAINT(!__warned, taint, format))       \
-                       __warned = true;                        \
-       unlikely(__ret_warn_once);                              \
-})
+#define WARN_TAINT_ONCE(condition, taint, format...)                   \
+       DO_ONCE_COND(condition, __WARN_printf_taint(taint, format))
 
 /*
  * WARN_ON_SMP() is for cases that the warning is either
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to