diff options
Diffstat (limited to 'include/linux/spinlock_api_smp.h')
-rw-r--r-- | include/linux/spinlock_api_smp.h | 75 |
1 files changed, 28 insertions, 47 deletions
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h index 7a7e18fc2415..8264a7f459bc 100644 --- a/include/linux/spinlock_api_smp.h +++ b/include/linux/spinlock_api_smp.h | |||
@@ -60,137 +60,118 @@ void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | |||
60 | void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | 60 | void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) |
61 | __releases(lock); | 61 | __releases(lock); |
62 | 62 | ||
63 | /* | 63 | #ifdef CONFIG_INLINE_SPIN_LOCK |
64 | * We inline the unlock functions in the nondebug case: | ||
65 | */ | ||
66 | #if !defined(CONFIG_DEBUG_SPINLOCK) && !defined(CONFIG_PREEMPT) | ||
67 | #define __always_inline__spin_unlock | ||
68 | #define __always_inline__read_unlock | ||
69 | #define __always_inline__write_unlock | ||
70 | #define __always_inline__spin_unlock_irq | ||
71 | #define __always_inline__read_unlock_irq | ||
72 | #define __always_inline__write_unlock_irq | ||
73 | #endif | ||
74 | |||
75 | #ifndef CONFIG_DEBUG_SPINLOCK | ||
76 | #ifndef CONFIG_GENERIC_LOCKBREAK | ||
77 | |||
78 | #ifdef __always_inline__spin_lock | ||
79 | #define _spin_lock(lock) __spin_lock(lock) | 64 | #define _spin_lock(lock) __spin_lock(lock) |
80 | #endif | 65 | #endif |
81 | 66 | ||
82 | #ifdef __always_inline__read_lock | 67 | #ifdef CONFIG_INLINE_READ_LOCK |
83 | #define _read_lock(lock) __read_lock(lock) | 68 | #define _read_lock(lock) __read_lock(lock) |
84 | #endif | 69 | #endif |
85 | 70 | ||
86 | #ifdef __always_inline__write_lock | 71 | #ifdef CONFIG_INLINE_WRITE_LOCK |
87 | #define _write_lock(lock) __write_lock(lock) | 72 | #define _write_lock(lock) __write_lock(lock) |
88 | #endif | 73 | #endif |
89 | 74 | ||
90 | #ifdef __always_inline__spin_lock_bh | 75 | #ifdef CONFIG_INLINE_SPIN_LOCK_BH |
91 | #define _spin_lock_bh(lock) __spin_lock_bh(lock) | 76 | #define _spin_lock_bh(lock) __spin_lock_bh(lock) |
92 | #endif | 77 | #endif |
93 | 78 | ||
94 | #ifdef __always_inline__read_lock_bh | 79 | #ifdef CONFIG_INLINE_READ_LOCK_BH |
95 | #define _read_lock_bh(lock) __read_lock_bh(lock) | 80 | #define _read_lock_bh(lock) __read_lock_bh(lock) |
96 | #endif | 81 | #endif |
97 | 82 | ||
98 | #ifdef __always_inline__write_lock_bh | 83 | #ifdef CONFIG_INLINE_WRITE_LOCK_BH |
99 | #define _write_lock_bh(lock) __write_lock_bh(lock) | 84 | #define _write_lock_bh(lock) __write_lock_bh(lock) |
100 | #endif | 85 | #endif |
101 | 86 | ||
102 | #ifdef __always_inline__spin_lock_irq | 87 | #ifdef CONFIG_INLINE_SPIN_LOCK_IRQ |
103 | #define _spin_lock_irq(lock) __spin_lock_irq(lock) | 88 | #define _spin_lock_irq(lock) __spin_lock_irq(lock) |
104 | #endif | 89 | #endif |
105 | 90 | ||
106 | #ifdef __always_inline__read_lock_irq | 91 | #ifdef CONFIG_INLINE_READ_LOCK_IRQ |
107 | #define _read_lock_irq(lock) __read_lock_irq(lock) | 92 | #define _read_lock_irq(lock) __read_lock_irq(lock) |
108 | #endif | 93 | #endif |
109 | 94 | ||
110 | #ifdef __always_inline__write_lock_irq | 95 | #ifdef CONFIG_INLINE_WRITE_LOCK_IRQ |
111 | #define _write_lock_irq(lock) __write_lock_irq(lock) | 96 | #define _write_lock_irq(lock) __write_lock_irq(lock) |
112 | #endif | 97 | #endif |
113 | 98 | ||
114 | #ifdef __always_inline__spin_lock_irqsave | 99 | #ifdef CONFIG_INLINE_SPIN_LOCK_IRQSAVE |
115 | #define _spin_lock_irqsave(lock) __spin_lock_irqsave(lock) | 100 | #define _spin_lock_irqsave(lock) __spin_lock_irqsave(lock) |
116 | #endif | 101 | #endif |
117 | 102 | ||
118 | #ifdef __always_inline__read_lock_irqsave | 103 | #ifdef CONFIG_INLINE_READ_LOCK_IRQSAVE |
119 | #define _read_lock_irqsave(lock) __read_lock_irqsave(lock) | 104 | #define _read_lock_irqsave(lock) __read_lock_irqsave(lock) |
120 | #endif | 105 | #endif |
121 | 106 | ||
122 | #ifdef __always_inline__write_lock_irqsave | 107 | #ifdef CONFIG_INLINE_WRITE_LOCK_IRQSAVE |
123 | #define _write_lock_irqsave(lock) __write_lock_irqsave(lock) | 108 | #define _write_lock_irqsave(lock) __write_lock_irqsave(lock) |
124 | #endif | 109 | #endif |
125 | 110 | ||
126 | #endif /* !CONFIG_GENERIC_LOCKBREAK */ | 111 | #ifdef CONFIG_INLINE_SPIN_TRYLOCK |
127 | |||
128 | #ifdef __always_inline__spin_trylock | ||
129 | #define _spin_trylock(lock) __spin_trylock(lock) | 112 | #define _spin_trylock(lock) __spin_trylock(lock) |
130 | #endif | 113 | #endif |
131 | 114 | ||
132 | #ifdef __always_inline__read_trylock | 115 | #ifdef CONFIG_INLINE_READ_TRYLOCK |
133 | #define _read_trylock(lock) __read_trylock(lock) | 116 | #define _read_trylock(lock) __read_trylock(lock) |
134 | #endif | 117 | #endif |
135 | 118 | ||
136 | #ifdef __always_inline__write_trylock | 119 | #ifdef CONFIG_INLINE_WRITE_TRYLOCK |
137 | #define _write_trylock(lock) __write_trylock(lock) | 120 | #define _write_trylock(lock) __write_trylock(lock) |
138 | #endif | 121 | #endif |
139 | 122 | ||
140 | #ifdef __always_inline__spin_trylock_bh | 123 | #ifdef CONFIG_INLINE_SPIN_TRYLOCK_BH |
141 | #define _spin_trylock_bh(lock) __spin_trylock_bh(lock) | 124 | #define _spin_trylock_bh(lock) __spin_trylock_bh(lock) |
142 | #endif | 125 | #endif |
143 | 126 | ||
144 | #ifdef __always_inline__spin_unlock | 127 | #ifdef CONFIG_INLINE_SPIN_UNLOCK |
145 | #define _spin_unlock(lock) __spin_unlock(lock) | 128 | #define _spin_unlock(lock) __spin_unlock(lock) |
146 | #endif | 129 | #endif |
147 | 130 | ||
148 | #ifdef __always_inline__read_unlock | 131 | #ifdef CONFIG_INLINE_READ_UNLOCK |
149 | #define _read_unlock(lock) __read_unlock(lock) | 132 | #define _read_unlock(lock) __read_unlock(lock) |
150 | #endif | 133 | #endif |
151 | 134 | ||
152 | #ifdef __always_inline__write_unlock | 135 | #ifdef CONFIG_INLINE_WRITE_UNLOCK |
153 | #define _write_unlock(lock) __write_unlock(lock) | 136 | #define _write_unlock(lock) __write_unlock(lock) |
154 | #endif | 137 | #endif |
155 | 138 | ||
156 | #ifdef __always_inline__spin_unlock_bh | 139 | #ifdef CONFIG_INLINE_SPIN_UNLOCK_BH |
157 | #define _spin_unlock_bh(lock) __spin_unlock_bh(lock) | 140 | #define _spin_unlock_bh(lock) __spin_unlock_bh(lock) |
158 | #endif | 141 | #endif |
159 | 142 | ||
160 | #ifdef __always_inline__read_unlock_bh | 143 | #ifdef CONFIG_INLINE_READ_UNLOCK_BH |
161 | #define _read_unlock_bh(lock) __read_unlock_bh(lock) | 144 | #define _read_unlock_bh(lock) __read_unlock_bh(lock) |
162 | #endif | 145 | #endif |
163 | 146 | ||
164 | #ifdef __always_inline__write_unlock_bh | 147 | #ifdef CONFIG_INLINE_WRITE_UNLOCK_BH |
165 | #define _write_unlock_bh(lock) __write_unlock_bh(lock) | 148 | #define _write_unlock_bh(lock) __write_unlock_bh(lock) |
166 | #endif | 149 | #endif |
167 | 150 | ||
168 | #ifdef __always_inline__spin_unlock_irq | 151 | #ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQ |
169 | #define _spin_unlock_irq(lock) __spin_unlock_irq(lock) | 152 | #define _spin_unlock_irq(lock) __spin_unlock_irq(lock) |
170 | #endif | 153 | #endif |
171 | 154 | ||
172 | #ifdef __always_inline__read_unlock_irq | 155 | #ifdef CONFIG_INLINE_READ_UNLOCK_IRQ |
173 | #define _read_unlock_irq(lock) __read_unlock_irq(lock) | 156 | #define _read_unlock_irq(lock) __read_unlock_irq(lock) |
174 | #endif | 157 | #endif |
175 | 158 | ||
176 | #ifdef __always_inline__write_unlock_irq | 159 | #ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQ |
177 | #define _write_unlock_irq(lock) __write_unlock_irq(lock) | 160 | #define _write_unlock_irq(lock) __write_unlock_irq(lock) |
178 | #endif | 161 | #endif |
179 | 162 | ||
180 | #ifdef __always_inline__spin_unlock_irqrestore | 163 | #ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE |
181 | #define _spin_unlock_irqrestore(lock, flags) __spin_unlock_irqrestore(lock, flags) | 164 | #define _spin_unlock_irqrestore(lock, flags) __spin_unlock_irqrestore(lock, flags) |
182 | #endif | 165 | #endif |
183 | 166 | ||
184 | #ifdef __always_inline__read_unlock_irqrestore | 167 | #ifdef CONFIG_INLINE_READ_UNLOCK_IRQRESTORE |
185 | #define _read_unlock_irqrestore(lock, flags) __read_unlock_irqrestore(lock, flags) | 168 | #define _read_unlock_irqrestore(lock, flags) __read_unlock_irqrestore(lock, flags) |
186 | #endif | 169 | #endif |
187 | 170 | ||
188 | #ifdef __always_inline__write_unlock_irqrestore | 171 | #ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE |
189 | #define _write_unlock_irqrestore(lock, flags) __write_unlock_irqrestore(lock, flags) | 172 | #define _write_unlock_irqrestore(lock, flags) __write_unlock_irqrestore(lock, flags) |
190 | #endif | 173 | #endif |
191 | 174 | ||
192 | #endif /* CONFIG_DEBUG_SPINLOCK */ | ||
193 | |||
194 | static inline int __spin_trylock(spinlock_t *lock) | 175 | static inline int __spin_trylock(spinlock_t *lock) |
195 | { | 176 | { |
196 | preempt_disable(); | 177 | preempt_disable(); |