]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - tools/lib/lockdep/uinclude/linux/kernel.h
tools/lib/lockdep: Fix 'unused value' warnings
[karo-tx-linux.git] / tools / lib / lockdep / uinclude / linux / kernel.h
1 #ifndef _LIBLOCKDEP_LINUX_KERNEL_H_
2 #define _LIBLOCKDEP_LINUX_KERNEL_H_
3
4 #include <linux/export.h>
5 #include <linux/types.h>
6 #include <linux/rcu.h>
7 #include <linux/hardirq.h>
8 #include <linux/kern_levels.h>
9
10 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
11
12 #ifndef container_of
13 #define container_of(ptr, type, member) ({                      \
14         const typeof(((type *)0)->member) * __mptr = (ptr);     \
15         (type *)((char *)__mptr - offsetof(type, member)); })
16 #endif
17
18 #define max(x, y) ({                            \
19         typeof(x) _max1 = (x);                  \
20         typeof(y) _max2 = (y);                  \
21         (void) (&_max1 == &_max2);              \
22         _max1 > _max2 ? _max1 : _max2; })
23
24 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
25
26 static inline int lockdep_warn(int condition)
27 {
28         return condition;
29 }
30 #define WARN_ON(x) lockdep_warn(x)
31 #define WARN_ON_ONCE(x) WARN_ON(x)
32 #define WARN(x, y...) WARN_ON(x)
33
34 #define likely(x) (x)
35 #define uninitialized_var(x) x
36 #define __init
37 #define noinline
38 #define list_add_tail_rcu list_add_tail
39 #define list_for_each_entry_rcu list_for_each_entry
40 #define barrier() 
41 #define synchronize_sched()
42
43 #ifndef CALLER_ADDR0
44 #define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
45 #endif
46
47 #ifndef _RET_IP_
48 #define _RET_IP_ CALLER_ADDR0
49 #endif
50
51 #ifndef _THIS_IP_
52 #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
53 #endif
54
55 #endif