Fix compatibility back to Linux 2.6.15 and 2.4.32.
[sliver-openvswitch.git] / datapath / linux-2.6 / compat-2.6 / include / asm-generic / bug.h
1 #ifndef __ASM_GENERIC_BUG_WRAPPER_H
2 #define __ASM_GENERIC_BUG_WRAPPER_H
3
4 #include_next <asm-generic/bug.h>
5
6 #include <linux/version.h>
7
8 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9
10 #define WARN_ON_ONCE(condition) ({                              \
11         static int __warned;                                    \
12         int __ret_warn_once = !!(condition);                    \
13                                                                 \
14         if (unlikely(__ret_warn_once) && !__warned) {           \
15                 WARN_ON(1);                                     \
16                 __warned = 1;                                   \
17         }                                                       \
18         unlikely(__ret_warn_once);                              \
19 })
20
21 #endif /* linux kernel < 2.6.19 */
22
23 #endif