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

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

diff -u --recursive --new-file v2.2.6/linux/include/asm-sparc/atomic.h linux/include/asm-sparc/atomic.h
@@ -41,13 +41,14 @@
 
 static __inline__ int atomic_read(atomic_t *v)
 {
-	int val;
+	int ret = v->counter;
 
-	__asm__ __volatile__("sra	%1, 0x8, %0"
-			     : "=r" (val)
-			     : "r" (v->counter));
-	return val;
+	while(ret & 0xff)
+		ret = v->counter;
+
+	return ret >> 8;
 }
+
 #define atomic_set(v, i)	(((v)->counter) = ((i) << 8))
 #endif
 

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