| .. | .. |
|---|
| 3 | 3 | #define _LINUX_LIST_BL_H |
|---|
| 4 | 4 | |
|---|
| 5 | 5 | #include <linux/list.h> |
|---|
| 6 | +#include <linux/spinlock.h> |
|---|
| 6 | 7 | #include <linux/bit_spinlock.h> |
|---|
| 7 | 8 | |
|---|
| 8 | 9 | /* |
|---|
| .. | .. |
|---|
| 33 | 34 | |
|---|
| 34 | 35 | struct hlist_bl_head { |
|---|
| 35 | 36 | struct hlist_bl_node *first; |
|---|
| 37 | +#ifdef CONFIG_PREEMPT_RT_BASE |
|---|
| 38 | + raw_spinlock_t lock; |
|---|
| 39 | +#endif |
|---|
| 36 | 40 | }; |
|---|
| 37 | 41 | |
|---|
| 38 | 42 | struct hlist_bl_node { |
|---|
| 39 | 43 | struct hlist_bl_node *next, **pprev; |
|---|
| 40 | 44 | }; |
|---|
| 41 | | -#define INIT_HLIST_BL_HEAD(ptr) \ |
|---|
| 42 | | - ((ptr)->first = NULL) |
|---|
| 45 | + |
|---|
| 46 | +#ifdef CONFIG_PREEMPT_RT_BASE |
|---|
| 47 | +#define INIT_HLIST_BL_HEAD(h) \ |
|---|
| 48 | +do { \ |
|---|
| 49 | + (h)->first = NULL; \ |
|---|
| 50 | + raw_spin_lock_init(&(h)->lock); \ |
|---|
| 51 | +} while (0) |
|---|
| 52 | +#else |
|---|
| 53 | +#define INIT_HLIST_BL_HEAD(h) (h)->first = NULL |
|---|
| 54 | +#endif |
|---|
| 43 | 55 | |
|---|
| 44 | 56 | static inline void INIT_HLIST_BL_NODE(struct hlist_bl_node *h) |
|---|
| 45 | 57 | { |
|---|
| .. | .. |
|---|
| 119 | 131 | |
|---|
| 120 | 132 | static inline void hlist_bl_lock(struct hlist_bl_head *b) |
|---|
| 121 | 133 | { |
|---|
| 134 | +#ifndef CONFIG_PREEMPT_RT_BASE |
|---|
| 122 | 135 | bit_spin_lock(0, (unsigned long *)b); |
|---|
| 136 | +#else |
|---|
| 137 | + raw_spin_lock(&b->lock); |
|---|
| 138 | +#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
|---|
| 139 | + __set_bit(0, (unsigned long *)b); |
|---|
| 140 | +#endif |
|---|
| 141 | +#endif |
|---|
| 123 | 142 | } |
|---|
| 124 | 143 | |
|---|
| 125 | 144 | static inline void hlist_bl_unlock(struct hlist_bl_head *b) |
|---|
| 126 | 145 | { |
|---|
| 146 | +#ifndef CONFIG_PREEMPT_RT_BASE |
|---|
| 127 | 147 | __bit_spin_unlock(0, (unsigned long *)b); |
|---|
| 148 | +#else |
|---|
| 149 | +#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
|---|
| 150 | + __clear_bit(0, (unsigned long *)b); |
|---|
| 151 | +#endif |
|---|
| 152 | + raw_spin_unlock(&b->lock); |
|---|
| 153 | +#endif |
|---|
| 128 | 154 | } |
|---|
| 129 | 155 | |
|---|
| 130 | 156 | static inline bool hlist_bl_is_locked(struct hlist_bl_head *b) |
|---|