tools: add WARN_ON_ONCE
[sfrench/cifs-2.6.git] / tools / include / asm / bug.h
index 9e5f4846967fcf6e098c039c61b455f1a9326b64..beda1a884b50f0465ace7e3f01ca6014e5d3e755 100644 (file)
        unlikely(__ret_warn_on);                \
 })
 
+#define WARN_ON_ONCE(condition) ({                     \
+       static int __warned;                            \
+       int __ret_warn_once = !!(condition);            \
+                                                       \
+       if (unlikely(__ret_warn_once && !__warned)) {   \
+               __warned = true;                        \
+               WARN_ON(1);                             \
+       }                                               \
+       unlikely(__ret_warn_once);                      \
+})
+
 #define WARN_ONCE(condition, format...)        ({      \
        static int __warned;                    \
        int __ret_warn_once = !!(condition);    \