patch-2.2.7 linux/include/asm-sparc/spinlock.h

Next file: linux/include/asm-sparc/system.h
Previous file: linux/include/asm-sparc/softirq.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.6/linux/include/asm-sparc/spinlock.h linux/include/asm-sparc/spinlock.h
@@ -6,6 +6,8 @@
 #ifndef __SPARC_SPINLOCK_H
 #define __SPARC_SPINLOCK_H
 
+#include <linux/tasks.h>	/* For NR_CPUS */
+
 #ifndef __ASSEMBLY__
 
 #ifndef __SMP__
@@ -67,6 +69,7 @@
 
 #define SPIN_LOCK_UNLOCKED	(spinlock_t) { 0, 0 }
 #define spin_lock_init(lp)	do { (lp)->owner_pc = 0; (lp)->lock = 0; } while(0)
+#define spin_is_locked(lp)  (*((volatile unsigned char *)(&((lp)->lock))) != 0)
 #define spin_unlock_wait(lp)	do { barrier(); } while(*(volatile unsigned char *)(&(lp)->lock))
 
 extern void _do_spin_lock(spinlock_t *lock, char *str);
@@ -86,7 +89,7 @@
 struct _rwlock_debug {
 	volatile unsigned int lock;
 	unsigned long owner_pc;
-	unsigned long reader_pc[NCPUS];
+	unsigned long reader_pc[NR_CPUS];
 };
 typedef struct _rwlock_debug rwlock_t;
 
@@ -139,7 +142,8 @@
 #define SPIN_LOCK_UNLOCKED	0
 
 #define spin_lock_init(lock)	(*(lock) = 0)
-#define spin_unlock_wait(lock)	do { barrier(); } while(*(volatile spinlock_t *)lock)
+#define spin_is_locked(lock)    (*((volatile unsigned char *)(lock)) != 0)
+#define spin_unlock_wait(lock)	do { barrier(); } while(*(volatile unsigned char *)lock)
 
 extern __inline__ void spin_lock(spinlock_t *lock)
 {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)