s390: uatomic add missing xchg return
[urcu.git] / urcu / uatomic_arch_s390.h
index 6b4e17eb78ad7cda400a0cae63e24f863502ea89..a8c8706e7b10c372ffe065394772b3c5089edbcb 100644 (file)
 #define uatomic_read(addr)     LOAD_SHARED(*(addr))
 
 /* xchg */
+
+static inline __attribute__((always_inline))
 unsigned long _uatomic_exchange(volatile void *addr, unsigned long val, int len)
 {
        switch (len) {
        case 4:
+       {
                unsigned int old_val;
 
                __asm__ __volatile__(
@@ -60,8 +63,11 @@ unsigned long _uatomic_exchange(volatile void *addr, unsigned long val, int len)
                        : "=&r"(old_val), "=m" (*addr)
                        : "r"(val), "m" (*addr)
                        : "memory", "cc");
+               return old_val;
+       }
 #if (BITS_PER_LONG == 64)
        case 8:
+       {
                unsigned long old_val;
 
                __asm__ __volatile__(
@@ -70,6 +76,8 @@ unsigned long _uatomic_exchange(volatile void *addr, unsigned long val, int len)
                        : "=&r"(old_val), "=m" (*addr)
                        : "r"(val), "m" (*addr)
                        : "memory", "cc");
+               return old_val;
+       }
 #endif
        default:
                __asm__ __volatile__(".long     0xd00d00");
@@ -86,26 +94,30 @@ unsigned long _uatomic_exchange(volatile void *addr, unsigned long val, int len)
 
 static inline __attribute__((always_inline))
 unsigned long _uatomic_cmpxchg(void *addr, unsigned long old,
-                              unsigned long new, int len)
+                              unsigned long _new, int len)
 {
        switch (len) {
        case 4:
+       {
                unsigned int old_val = (unsigned int)old;
 
                __asm__ __volatile__(
                        "       cs %0,%2,%1\n"
                        : "+r"(old_val), "+m"(*addr)
-                       : "r"(new)
+                       : "r"(_new)
                        : "memory", "cc");
                return old_val;
+       }
 #if (BITS_PER_LONG == 64)
        case 8:
+       {
                __asm__ __volatile__(
                        "       csg %0,%2,%1\n"
                        : "+r"(old), "+m"(*addr)
-                       : "r"(new)
+                       : "r"(_new)
                        : "memory", "cc");
                return old;
+       }
 #endif
        default:
                __asm__ __volatile__(".long     0xd00d00");
@@ -114,10 +126,10 @@ unsigned long _uatomic_cmpxchg(void *addr, unsigned long old,
        return 0;
 }
 
-#define uatomic_cmpxchg(addr, old, new)                                        \
+#define uatomic_cmpxchg(addr, old, _new)                               \
        (__typeof__(*(addr))) _uatomic_cmpxchg((addr),                  \
                                               (unsigned long)(old),    \
-                                              (unsigned long)(new),    \
+                                              (unsigned long)(_new),   \
                                               sizeof(*(addr)))
 
 /* uatomic_add_return */
This page took 0.023719 seconds and 4 git commands to generate.