10 #include <linux/compiler.h>
11 #include <linux/err.h>
12 #include <linux/bitops.h>
13 #include <linux/log2.h>
14 #include "../../../include/linux/kconfig.h"
17 #define RADIX_TREE_MAP_SHIFT 6
19 #define RADIX_TREE_MAP_SHIFT 3
26 #define BUG_ON(expr) assert(!(expr))
27 #define WARN_ON(expr) assert(!(expr))
33 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
34 #define pr_debug printk
36 #define smp_rmb() barrier()
37 #define smp_wmb() barrier()
38 #define cpu_relax() barrier()
40 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
42 #define container_of(ptr, type, member) ({ \
43 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
44 (type *)( (char *)__mptr - offsetof(type, member) );})
45 #define min(a, b) ((a) < (b) ? (a) : (b))
47 #define cond_resched() sched_yield()
49 static inline int in_interrupt(void)
55 * This looks more complex than it should be. But we need to
56 * get the type for the ~ right in round_down (it needs to be
57 * as wide as the result!), and we want to evaluate the macro
58 * arguments just once each.
60 #define __round_mask(x, y) ((__typeof__(x))((y)-1))
61 #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
62 #define round_down(x, y) ((x) & ~__round_mask(x, y))
64 #define xchg(ptr, x) uatomic_xchg(ptr, x)
66 #endif /* _KERNEL_H */