diff options
Diffstat (limited to 'include/asm-sparc64/spinlock.h')
-rw-r--r-- | include/asm-sparc64/spinlock.h | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h index 9cb93a5c2b4f..a02c4370eb42 100644 --- a/include/asm-sparc64/spinlock.h +++ b/include/asm-sparc64/spinlock.h | |||
@@ -43,7 +43,7 @@ typedef struct { | |||
43 | #define spin_is_locked(lp) ((lp)->lock != 0) | 43 | #define spin_is_locked(lp) ((lp)->lock != 0) |
44 | 44 | ||
45 | #define spin_unlock_wait(lp) \ | 45 | #define spin_unlock_wait(lp) \ |
46 | do { membar("#LoadLoad"); \ | 46 | do { rmb(); \ |
47 | } while((lp)->lock) | 47 | } while((lp)->lock) |
48 | 48 | ||
49 | static inline void _raw_spin_lock(spinlock_t *lock) | 49 | static inline void _raw_spin_lock(spinlock_t *lock) |
@@ -129,15 +129,18 @@ typedef struct { | |||
129 | #define spin_is_locked(__lock) ((__lock)->lock != 0) | 129 | #define spin_is_locked(__lock) ((__lock)->lock != 0) |
130 | #define spin_unlock_wait(__lock) \ | 130 | #define spin_unlock_wait(__lock) \ |
131 | do { \ | 131 | do { \ |
132 | membar("#LoadLoad"); \ | 132 | rmb(); \ |
133 | } while((__lock)->lock) | 133 | } while((__lock)->lock) |
134 | 134 | ||
135 | extern void _do_spin_lock (spinlock_t *lock, char *str); | 135 | extern void _do_spin_lock(spinlock_t *lock, char *str, unsigned long caller); |
136 | extern void _do_spin_unlock (spinlock_t *lock); | 136 | extern void _do_spin_unlock(spinlock_t *lock); |
137 | extern int _do_spin_trylock (spinlock_t *lock); | 137 | extern int _do_spin_trylock(spinlock_t *lock, unsigned long caller); |
138 | 138 | ||
139 | #define _raw_spin_trylock(lp) _do_spin_trylock(lp) | 139 | #define _raw_spin_trylock(lp) \ |
140 | #define _raw_spin_lock(lock) _do_spin_lock(lock, "spin_lock") | 140 | _do_spin_trylock(lp, (unsigned long) __builtin_return_address(0)) |
141 | #define _raw_spin_lock(lock) \ | ||
142 | _do_spin_lock(lock, "spin_lock", \ | ||
143 | (unsigned long) __builtin_return_address(0)) | ||
141 | #define _raw_spin_unlock(lock) _do_spin_unlock(lock) | 144 | #define _raw_spin_unlock(lock) _do_spin_unlock(lock) |
142 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | 145 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) |
143 | 146 | ||
@@ -279,37 +282,41 @@ typedef struct { | |||
279 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { } } | 282 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { } } |
280 | #define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) | 283 | #define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) |
281 | 284 | ||
282 | extern void _do_read_lock(rwlock_t *rw, char *str); | 285 | extern void _do_read_lock(rwlock_t *rw, char *str, unsigned long caller); |
283 | extern void _do_read_unlock(rwlock_t *rw, char *str); | 286 | extern void _do_read_unlock(rwlock_t *rw, char *str, unsigned long caller); |
284 | extern void _do_write_lock(rwlock_t *rw, char *str); | 287 | extern void _do_write_lock(rwlock_t *rw, char *str, unsigned long caller); |
285 | extern void _do_write_unlock(rwlock_t *rw); | 288 | extern void _do_write_unlock(rwlock_t *rw, unsigned long caller); |
286 | extern int _do_write_trylock(rwlock_t *rw, char *str); | 289 | extern int _do_write_trylock(rwlock_t *rw, char *str, unsigned long caller); |
287 | 290 | ||
288 | #define _raw_read_lock(lock) \ | 291 | #define _raw_read_lock(lock) \ |
289 | do { unsigned long flags; \ | 292 | do { unsigned long flags; \ |
290 | local_irq_save(flags); \ | 293 | local_irq_save(flags); \ |
291 | _do_read_lock(lock, "read_lock"); \ | 294 | _do_read_lock(lock, "read_lock", \ |
295 | (unsigned long) __builtin_return_address(0)); \ | ||
292 | local_irq_restore(flags); \ | 296 | local_irq_restore(flags); \ |
293 | } while(0) | 297 | } while(0) |
294 | 298 | ||
295 | #define _raw_read_unlock(lock) \ | 299 | #define _raw_read_unlock(lock) \ |
296 | do { unsigned long flags; \ | 300 | do { unsigned long flags; \ |
297 | local_irq_save(flags); \ | 301 | local_irq_save(flags); \ |
298 | _do_read_unlock(lock, "read_unlock"); \ | 302 | _do_read_unlock(lock, "read_unlock", \ |
303 | (unsigned long) __builtin_return_address(0)); \ | ||
299 | local_irq_restore(flags); \ | 304 | local_irq_restore(flags); \ |
300 | } while(0) | 305 | } while(0) |
301 | 306 | ||
302 | #define _raw_write_lock(lock) \ | 307 | #define _raw_write_lock(lock) \ |
303 | do { unsigned long flags; \ | 308 | do { unsigned long flags; \ |
304 | local_irq_save(flags); \ | 309 | local_irq_save(flags); \ |
305 | _do_write_lock(lock, "write_lock"); \ | 310 | _do_write_lock(lock, "write_lock", \ |
311 | (unsigned long) __builtin_return_address(0)); \ | ||
306 | local_irq_restore(flags); \ | 312 | local_irq_restore(flags); \ |
307 | } while(0) | 313 | } while(0) |
308 | 314 | ||
309 | #define _raw_write_unlock(lock) \ | 315 | #define _raw_write_unlock(lock) \ |
310 | do { unsigned long flags; \ | 316 | do { unsigned long flags; \ |
311 | local_irq_save(flags); \ | 317 | local_irq_save(flags); \ |
312 | _do_write_unlock(lock); \ | 318 | _do_write_unlock(lock, \ |
319 | (unsigned long) __builtin_return_address(0)); \ | ||
313 | local_irq_restore(flags); \ | 320 | local_irq_restore(flags); \ |
314 | } while(0) | 321 | } while(0) |
315 | 322 | ||
@@ -317,7 +324,8 @@ do { unsigned long flags; \ | |||
317 | ({ unsigned long flags; \ | 324 | ({ unsigned long flags; \ |
318 | int val; \ | 325 | int val; \ |
319 | local_irq_save(flags); \ | 326 | local_irq_save(flags); \ |
320 | val = _do_write_trylock(lock, "write_trylock"); \ | 327 | val = _do_write_trylock(lock, "write_trylock", \ |
328 | (unsigned long) __builtin_return_address(0)); \ | ||
321 | local_irq_restore(flags); \ | 329 | local_irq_restore(flags); \ |
322 | val; \ | 330 | val; \ |
323 | }) | 331 | }) |