patch-2.1.36 linux/include/asm-sparc/semaphore.h

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

diff -u --recursive --new-file v2.1.35/linux/include/asm-sparc/semaphore.h linux/include/asm-sparc/semaphore.h
@@ -13,8 +13,8 @@
 	struct wait_queue * wait;
 };
 
-#define MUTEX ((struct semaphore) { { (1 << 8) }, { 0 }, NULL })
-#define MUTEX_LOCKED ((struct semaphore) { { 0 }, { 0 }, NULL })
+#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), ATOMIC_INIT(0), NULL })
+#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), ATOMIC_INIT(0), NULL })
 
 extern void __down(struct semaphore * sem);
 extern int __down_interruptible(struct semaphore * sem);
@@ -22,6 +22,12 @@
 
 #define sema_init(sem, val)	atomic_set(&((sem)->count), val)
 
+#define wake_one_more(sem)	atomic_inc(&sem->waking);
+
+/* XXX Put this in raw assembler for SMP case so that the atomic_t
+ * XXX spinlock can allow this to be done without grabbing the IRQ
+ * XXX global lock.
+ */
 static inline int waking_non_zero(struct semaphore *sem)
 {
 	unsigned long flags;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov