patch-2.1.48 linux/include/asm-sparc64/semaphore.h

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

diff -u --recursive --new-file v2.1.47/linux/include/asm-sparc64/semaphore.h linux/include/asm-sparc64/semaphore.h
@@ -24,20 +24,17 @@
 
 #define wake_one_more(sem)      atomic_inc(&sem->waking);
 
-extern __inline__ int waking_non_zero(struct semaphore *sem)
-{
-        unsigned long flags;
-        int ret = 0;
-
-        save_flags(flags);
-        cli();
-        if (atomic_read(&sem->waking) > 0) {
-                atomic_dec(&sem->waking);
-                ret = 1;
-        }
-        restore_flags(flags);
-        return ret;
-}
+#define waking_non_zero(sem) \
+({	unsigned long flags; \
+	int ret = 0; \
+	save_and_cli(flags); \
+	if (atomic_read(&sem->waking) > 0) { \
+		atomic_dec(&sem->waking); \
+		ret = 1; \
+	} \
+	restore_flags(flags); \
+	ret; \
+})
 
 extern __inline__ void down(struct semaphore * sem)
 {

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