datapath: Fix sparse warning for symbol 'BUILD_BUG_ON_NOT_POWER_OF_2'
[openvswitch] / datapath / linux / compat / include / linux / kernel.h
1 #ifndef __KERNEL_H_WRAPPER
2 #define __KERNEL_H_WRAPPER 1
3
4 #include_next <linux/kernel.h>
5 #ifndef HAVE_LOG2_H
6 #include <linux/log2.h>
7 #endif
8
9 #include <linux/version.h>
10 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
11 /* BUILD_BUG_ON_NOT_POWER_OF_2 definition */
12 #include <linux/bug.h>
13 #endif
14
15 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
16 #undef pr_emerg
17 #define pr_emerg(fmt, ...) \
18         printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
19 #undef pr_alert
20 #define pr_alert(fmt, ...) \
21         printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
22 #undef pr_crit
23 #define pr_crit(fmt, ...) \
24         printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
25 #undef pr_err
26 #define pr_err(fmt, ...) \
27         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
28 #undef pr_warning
29 #define pr_warning(fmt, ...) \
30         printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
31 #undef pr_notice
32 #define pr_notice(fmt, ...) \
33         printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
34 #undef pr_info
35 #define pr_info(fmt, ...) \
36         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
37 #undef pr_cont
38 #define pr_cont(fmt, ...) \
39         printk(KERN_CONT fmt, ##__VA_ARGS__)
40 #endif
41
42 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
43 #define pr_warn pr_warning
44 #endif
45
46 #if defined(CONFIG_PREEMPT) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
47 #error "CONFIG_PREEMPT is broken before 2.6.21--see commit 4498121ca3, \"[NET]: Handle disabled preemption in gfp_any()\""
48 #endif
49
50 #ifndef USHRT_MAX
51 #define USHRT_MAX       ((u16)(~0U))
52 #define SHRT_MAX        ((s16)(USHRT_MAX>>1))
53 #define SHRT_MIN        ((s16)(-SHRT_MAX - 1))
54 #endif
55
56 #ifndef DIV_ROUND_UP
57 #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
58 #endif
59
60 #endif /* linux/kernel.h */