Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / include / linux / spinlock_types_rt.h
1 #ifndef __LINUX_SPINLOCK_TYPES_RT_H
2 #define __LINUX_SPINLOCK_TYPES_RT_H
3
4 #ifndef __LINUX_SPINLOCK_TYPES_H
5 #error "Do not include directly. Include spinlock_types.h instead"
6 #endif
7
8 #include <linux/cache.h>
9
10 /*
11  * PREEMPT_RT: spinlocks - an RT mutex plus lock-break field:
12  */
13 typedef struct spinlock {
14         struct rt_mutex         lock;
15         unsigned int            break_lock;
16 #ifdef CONFIG_DEBUG_LOCK_ALLOC
17         struct lockdep_map      dep_map;
18 #endif
19 } spinlock_t;
20
21 #ifdef CONFIG_DEBUG_RT_MUTEXES
22 # define __RT_SPIN_INITIALIZER(name) \
23         { \
24         .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \
25         .save_state = 1, \
26         .file = __FILE__, \
27         .line = __LINE__ , \
28         }
29 #else
30 # define __RT_SPIN_INITIALIZER(name) \
31         {                                                               \
32         .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock),          \
33         .save_state = 1, \
34         }
35 #endif
36
37 /*
38 .wait_list = PLIST_HEAD_INIT_RAW((name).lock.wait_list, (name).lock.wait_lock)
39 */
40
41 #define __SPIN_LOCK_UNLOCKED(name)                      \
42         { .lock = __RT_SPIN_INITIALIZER(name.lock),             \
43           SPIN_DEP_MAP_INIT(name) }
44
45 #define __DEFINE_SPINLOCK(name) \
46         spinlock_t name = __SPIN_LOCK_UNLOCKED(name)
47
48 #define DEFINE_SPINLOCK(name) \
49         spinlock_t name __cacheline_aligned_in_smp = __SPIN_LOCK_UNLOCKED(name)
50
51 #endif