]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - tools/lib/lockdep/uinclude/linux/kernel.h
tools/lib/lockdep: Include err.h
[mirror_ubuntu-artful-kernel.git] / tools / lib / lockdep / uinclude / linux / kernel.h
CommitLineData
5634bd7d
SL
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>
f9155dd8 9#include <linux/err.h>
5634bd7d 10
108744c4
BH
11#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
12
5634bd7d
SL
13#ifndef container_of
14#define container_of(ptr, type, member) ({ \
15 const typeof(((type *)0)->member) * __mptr = (ptr); \
16 (type *)((char *)__mptr - offsetof(type, member)); })
17#endif
18
19#define max(x, y) ({ \
20 typeof(x) _max1 = (x); \
21 typeof(y) _max2 = (y); \
22 (void) (&_max1 == &_max2); \
23 _max1 > _max2 ? _max1 : _max2; })
24
25#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
bb7ea2a9
BH
26
27static inline int lockdep_warn(int condition)
28{
29 return condition;
30}
31#define WARN_ON(x) lockdep_warn(x)
32#define WARN_ON_ONCE(x) WARN_ON(x)
33#define WARN(x, y...) WARN_ON(x)
34
5634bd7d 35#define likely(x) (x)
5634bd7d
SL
36#define uninitialized_var(x) x
37#define __init
38#define noinline
39#define list_add_tail_rcu list_add_tail
2480257f
ES
40#define list_for_each_entry_rcu list_for_each_entry
41#define barrier()
42#define synchronize_sched()
5634bd7d
SL
43
44#ifndef CALLER_ADDR0
45#define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
46#endif
47
48#ifndef _RET_IP_
49#define _RET_IP_ CALLER_ADDR0
50#endif
51
52#ifndef _THIS_IP_
53#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
54#endif
55
6c8e6483
LASL
56#define pr_err(format, ...) fprintf (stderr, format, ## __VA_ARGS__)
57
5634bd7d 58#endif