aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/spinlock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/spinlock.h')
-rw-r--r--include/linux/spinlock.h69
1 files changed, 15 insertions, 54 deletions
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 57f670d78f7c..8451052ca66f 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -52,7 +52,6 @@
52#include <linux/thread_info.h> 52#include <linux/thread_info.h>
53#include <linux/kernel.h> 53#include <linux/kernel.h>
54#include <linux/stringify.h> 54#include <linux/stringify.h>
55#include <linux/irqflags.h>
56 55
57#include <asm/system.h> 56#include <asm/system.h>
58 57
@@ -184,52 +183,24 @@ do { \
184#define read_lock(lock) _read_lock(lock) 183#define read_lock(lock) _read_lock(lock)
185 184
186#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 185#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
187#define spin_lock_irqsave(lock, flags) \ 186
188 do { \ 187#define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock)
189 BUILD_CHECK_IRQ_FLAGS(flags); \ 188#define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock)
190 flags = _spin_lock_irqsave(lock); \ 189#define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock)
191 } while (0)
192#define read_lock_irqsave(lock, flags) \
193 do { \
194 BUILD_CHECK_IRQ_FLAGS(flags); \
195 flags = _read_lock_irqsave(lock); \
196 } while (0)
197#define write_lock_irqsave(lock, flags) \
198 do { \
199 BUILD_CHECK_IRQ_FLAGS(flags); \
200 flags = _write_lock_irqsave(lock); \
201 } while (0)
202 190
203#ifdef CONFIG_DEBUG_LOCK_ALLOC 191#ifdef CONFIG_DEBUG_LOCK_ALLOC
204#define spin_lock_irqsave_nested(lock, flags, subclass) \ 192#define spin_lock_irqsave_nested(lock, flags, subclass) \
205 do { \ 193 flags = _spin_lock_irqsave_nested(lock, subclass)
206 BUILD_CHECK_IRQ_FLAGS(flags); \
207 flags = _spin_lock_irqsave_nested(lock, subclass); \
208 } while (0)
209#else 194#else
210#define spin_lock_irqsave_nested(lock, flags, subclass) \ 195#define spin_lock_irqsave_nested(lock, flags, subclass) \
211 do { \ 196 flags = _spin_lock_irqsave(lock)
212 BUILD_CHECK_IRQ_FLAGS(flags); \
213 flags = _spin_lock_irqsave(lock); \
214 } while (0)
215#endif 197#endif
216 198
217#else 199#else
218#define spin_lock_irqsave(lock, flags) \ 200
219 do { \ 201#define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags)
220 BUILD_CHECK_IRQ_FLAGS(flags); \ 202#define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags)
221 _spin_lock_irqsave(lock, flags); \ 203#define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags)
222 } while (0)
223#define read_lock_irqsave(lock, flags) \
224 do { \
225 BUILD_CHECK_IRQ_FLAGS(flags); \
226 _read_lock_irqsave(lock, flags); \
227 } while (0)
228#define write_lock_irqsave(lock, flags) \
229 do { \
230 BUILD_CHECK_IRQ_FLAGS(flags); \
231 _write_lock_irqsave(lock, flags); \
232 } while (0)
233#define spin_lock_irqsave_nested(lock, flags, subclass) \ 204#define spin_lock_irqsave_nested(lock, flags, subclass) \
234 spin_lock_irqsave(lock, flags) 205 spin_lock_irqsave(lock, flags)
235 206
@@ -268,24 +239,15 @@ do { \
268#endif 239#endif
269 240
270#define spin_unlock_irqrestore(lock, flags) \ 241#define spin_unlock_irqrestore(lock, flags) \
271 do { \ 242 _spin_unlock_irqrestore(lock, flags)
272 BUILD_CHECK_IRQ_FLAGS(flags); \
273 _spin_unlock_irqrestore(lock, flags); \
274 } while (0)
275#define spin_unlock_bh(lock) _spin_unlock_bh(lock) 243#define spin_unlock_bh(lock) _spin_unlock_bh(lock)
276 244
277#define read_unlock_irqrestore(lock, flags) \ 245#define read_unlock_irqrestore(lock, flags) \
278 do { \ 246 _read_unlock_irqrestore(lock, flags)
279 BUILD_CHECK_IRQ_FLAGS(flags); \
280 _read_unlock_irqrestore(lock, flags); \
281 } while (0)
282#define read_unlock_bh(lock) _read_unlock_bh(lock) 247#define read_unlock_bh(lock) _read_unlock_bh(lock)
283 248
284#define write_unlock_irqrestore(lock, flags) \ 249#define write_unlock_irqrestore(lock, flags) \
285 do { \ 250 _write_unlock_irqrestore(lock, flags)
286 BUILD_CHECK_IRQ_FLAGS(flags); \
287 _write_unlock_irqrestore(lock, flags); \
288 } while (0)
289#define write_unlock_bh(lock) _write_unlock_bh(lock) 251#define write_unlock_bh(lock) _write_unlock_bh(lock)
290 252
291#define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock)) 253#define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock))
@@ -299,7 +261,6 @@ do { \
299 261
300#define spin_trylock_irqsave(lock, flags) \ 262#define spin_trylock_irqsave(lock, flags) \
301({ \ 263({ \
302 BUILD_CHECK_IRQ_FLAGS(flags); \
303 local_irq_save(flags); \ 264 local_irq_save(flags); \
304 spin_trylock(lock) ? \ 265 spin_trylock(lock) ? \
305 1 : ({ local_irq_restore(flags); 0; }); \ 266 1 : ({ local_irq_restore(flags); 0; }); \