From dcec8a13bf565e47942a1751a9cec21bec5648fe Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Thu, 7 May 1998 02:55:41 +0000 Subject: o Merge with Linux 2.1.99. o Fix ancient bug in the ELF loader making ldd crash. o Fix ancient bug in the keyboard code for SGI, SNI and Jazz. --- include/asm-ppc/spinlock.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'include/asm-ppc/spinlock.h') diff --git a/include/asm-ppc/spinlock.h b/include/asm-ppc/spinlock.h index bb4af6a0c..00f1de281 100644 --- a/include/asm-ppc/spinlock.h +++ b/include/asm-ppc/spinlock.h @@ -57,27 +57,24 @@ typedef struct { } rwlock_t; * We make no fairness assumptions. They have a cost. */ -struct _spinlock_debug { +typedef struct { volatile unsigned long lock; volatile unsigned long owner_pc; -}; - -typedef struct _spinlock_debug spinlock_t; + volatile unsigned long owner_cpu; +} spinlock_t; -#define SPIN_LOCK_UNLOCKED { 0, 0 } - -#define SPIN_LOCK_UNLOCKED { 0, 0 } -#define spin_lock_init(lp) do { (lp)->owner_pc = 0; (lp)->lock = 0; } while(0) +#define SPIN_LOCK_UNLOCKED { 0, 0, 0 } +#define spin_lock_init(lp) \ +do { spinlock_t *p = (lp); p->owner_pc = p->owner_cpu = p->lock = 0; } while(0) #define spin_unlock_wait(lp) do { barrier(); } while((lp)->lock) extern void _spin_lock(spinlock_t *lock); extern void _spin_unlock(spinlock_t *lock); +extern int spin_trylock(spinlock_t *lock); #define spin_lock(lp) _spin_lock(lp) #define spin_unlock(lp) _spin_unlock(lp) -#define spin_trylock(l) (!test_and_set_bit(0, &((l)->lock) )) - #define spin_lock_irq(lock) \ do { __cli(); spin_lock(lock); } while (0) #define spin_unlock_irq(lock) \ -- cgit v1.2.3