patch-2.2.17 linux/include/asm-s390/atomic.h

Next file: linux/include/asm-s390/bitops.h
Previous file: linux/include/asm-ppc/unistd.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.16/include/asm-s390/atomic.h linux/include/asm-s390/atomic.h
@@ -38,7 +38,7 @@
 {
         __asm__ __volatile__("st  %1,%0\n\t"
                              "bcr 15,0"
-                             : : "m" (*v), "d" (i) : "memory");
+                             : "=m" (*v) : "d" (i) );
 }
 
 static __inline__ void atomic_add(int i, atomic_t *v)
@@ -48,7 +48,7 @@
                              "   ar    1,%1\n"
                              "   cs    0,1,%0\n"
                              "   jl    0b"
-                             : "+m" (*v) : "d" (i) : "0", "1" );
+                             : "+m" (*v) : "d" (i) : "0", "1", "cc" );
 }
 
 static __inline__ void atomic_sub(int i, atomic_t *v)
@@ -58,7 +58,7 @@
                              "   sr    1,%1\n"
                              "   cs    0,1,%0\n"
                              "   jl    0b"
-                             : "+m" (*v) : "d" (i) : "0", "1" );
+                             : "+m" (*v) : "d" (i) : "0", "1", "cc" );
 }
 
 static __inline__ void atomic_inc(volatile atomic_t *v)
@@ -68,7 +68,7 @@
                              "   ahi   1,1\n"
                              "   cs    0,1,%0\n"
                              "   jl    0b"
-                             : "+m" (*v) : : "0", "1" );
+                             : "+m" (*v) : : "0", "1", "cc" );
 }
 
 static __inline__ int atomic_inc_return(volatile atomic_t *v)
@@ -79,7 +79,7 @@
                              "   ahi   %1,1\n"
                              "   cs    0,%1,%0\n"
                              "   jl    0b"
-                             : "+m" (*v), "=&d" (i) : : "0" );
+                             : "+m" (*v), "=&d" (i) : : "0", "cc" );
         return i;
 }
 
@@ -90,7 +90,7 @@
                              "   ahi   1,-1\n"
                              "   cs    0,1,%0\n"
                              "   jl    0b"
-                             : "+m" (*v) : : "0", "1" );
+                             : "+m" (*v) : : "0", "1", "cc" );
 }
 
 static __inline__ int atomic_dec_return(volatile atomic_t *v)
@@ -101,7 +101,7 @@
                              "   ahi   %1,-1\n"
                              "   cs    0,%1,%0\n"
                              "   jl    0b"
-                             : "+m" (*v), "=&d" (i) : : "0" );
+                             : "+m" (*v), "=&d" (i) : : "0", "cc" );
         return i;
 }
 
@@ -113,7 +113,7 @@
                              "   ahi   %1,-1\n"
                              "   cs    0,%1,%0\n"
                              "   jl    0b"
-                             : "+m" (*v), "=&d" (i) : : "0");
+                             : "+m" (*v), "=&d" (i) : : "0", "cc");
         return i == 0;
 }
 
@@ -124,7 +124,7 @@
                              "   nr    1,%1\n"
                              "   cs    0,1,%0\n"
                              "   jl    0b"
-                             : "+m" (*v) : "d" (~(mask)) : "0", "1" );
+                             : "+m" (*v) : "d" (~(mask)) : "0", "1", "cc" );
 }
 
 static __inline__ void atomic_set_mask(unsigned long mask, atomic_t *v)
@@ -134,7 +134,7 @@
                              "   or    1,%1\n"
                              "   cs    0,1,%0\n"
                              "   jl    0b"
-                             : "+m" (*v) : "d" (mask) : "0", "1" );
+                             : "+m" (*v) : "d" (mask) : "0", "1", "cc" );
 }
 
 /*
@@ -153,7 +153,7 @@
                 "0:"
                 : "=&r" (retval), "+m" (*v)
                 : "d" (expected_oldval) , "d" (new_val)
-                : "memory", "cc");
+                : "cc");
         return retval;
 }
 
@@ -169,13 +169,13 @@
                 "   jl  0b\n"
                 : "+m" (*v)
                 : "d" (expected_oldval) , "d" (new_val)
-                : "memory", "cc", "1");
+                : "cc", "1");
 }
 
 /*
  * Increase and test if atomic counter > 0
  */
-extern __inline__ int atomic_inc_and_test_greater_zero(volatile atomic_t *v)
+extern __inline__ int atomic_inc_and_test_greater_zero(atomic_t *v)
 {
         int i;
         __asm__ __volatile__("   l     0,%0\n"
@@ -183,8 +183,15 @@
                              "   ahi   %1,1\n"
                              "   cs    0,%1,%0\n"
                              "   jl    0b"
-                             : "+m" (*v), "=&d" (i) : : "0" );
+                             : "+m" (*v), "=&d" (i) : : "0", "cc" );
         return i > 0;
+}
+
+#define atomic_compare_and_swap_debug(where,from,to) \
+if (atomic_compare_and_swap ((from), (to), (where))) {\
+	printk (KERN_WARNING"%s/%d atomic counter:%s couldn't be changed from %d(%s) to %d(%s), was %d\n",\
+		__FILE__,__LINE__,#where,(from),#from,(to),#to,atomic_read (where));\
+        atomic_set(where,(to));\
 }
 
 #endif                                 /* __ARCH_S390_ATOMIC __            */

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