add uatomic_generic.h, use it for common definitions
[urcu.git] / urcu / uatomic_arch_x86.h
index 3bfe86d0a31f35e9a3f04a1c5079811b8971e167..e358be3673552dd9919ca6579e2c83071410157a 100644 (file)
@@ -49,7 +49,6 @@ struct __uatomic_dummy {
 #define __hp(x)        ((struct __uatomic_dummy *)(x))
 
 #define _uatomic_set(addr, v)  STORE_SHARED(*(addr), (v))
-#define _uatomic_read(addr)    LOAD_SHARED(*(addr))
 
 /* cmpxchg */
 
@@ -176,7 +175,7 @@ unsigned long __uatomic_exchange(void *addr, unsigned long val, int len)
        ((__typeof__(*(addr))) __uatomic_exchange((addr), (unsigned long)(v), \
                                                sizeof(*(addr))))
 
-/* uatomic_add_return, uatomic_sub_return */
+/* uatomic_add_return */
 
 static inline __attribute__((always_inline))
 unsigned long __uatomic_add_return(void *addr, unsigned long val,
@@ -241,9 +240,7 @@ unsigned long __uatomic_add_return(void *addr, unsigned long val,
                                                  (unsigned long)(v),   \
                                                  sizeof(*(addr))))
 
-#define _uatomic_sub_return(addr, v)   _uatomic_add_return((addr), -(v))
-
-/* uatomic_add, uatomic_sub */
+/* uatomic_add */
 
 static inline __attribute__((always_inline))
 void __uatomic_add(void *addr, unsigned long val, int len)
@@ -297,8 +294,6 @@ void __uatomic_add(void *addr, unsigned long val, int len)
 #define _uatomic_add(addr, v)                                             \
        (__uatomic_add((addr), (unsigned long)(v), sizeof(*(addr))))
 
-#define _uatomic_sub(addr, v)  _uatomic_add((addr), -(v))
-
 
 /* uatomic_inc */
 
@@ -449,36 +444,29 @@ extern unsigned long _compat_uatomic_xchg(void *addr,
                                                (unsigned long)(v),            \
                                                sizeof(*(addr))))
 
-#define compat_uatomic_sub_return(addr, v)                                    \
-               compat_uatomic_add_return((addr), -(v))
 #define compat_uatomic_add(addr, v)                                           \
                ((void)compat_uatomic_add_return((addr), (v)))
-#define compat_uatomic_sub(addr, v)                                           \
-               ((void)compat_uatomic_sub_return((addr), (v)))
 #define compat_uatomic_inc(addr)                                              \
                (compat_uatomic_add((addr), 1))
 #define compat_uatomic_dec(addr)                                              \
-               (compat_uatomic_sub((addr), 1))
+               (compat_uatomic_add((addr), -1))
 
 #else
 #define UATOMIC_COMPAT(insn)   (_uatomic_##insn)
 #endif
 
 /* Read is atomic even in compat mode */
-#define uatomic_read(addr)     _uatomic_read(addr)
-
 #define uatomic_set(addr, v)                   \
                UATOMIC_COMPAT(set(addr, v))
+
 #define uatomic_cmpxchg(addr, old, _new)       \
                UATOMIC_COMPAT(cmpxchg(addr, old, _new))
 #define uatomic_xchg(addr, v)                  \
                UATOMIC_COMPAT(xchg(addr, v))
 #define uatomic_add_return(addr, v)            \
                UATOMIC_COMPAT(add_return(addr, v))
-#define uatomic_sub_return(addr, v)            \
-               UATOMIC_COMPAT(sub_return(addr, v))
+
 #define uatomic_add(addr, v)   UATOMIC_COMPAT(add(addr, v))
-#define uatomic_sub(addr, v)   UATOMIC_COMPAT(sub(addr, v))
 #define uatomic_inc(addr)      UATOMIC_COMPAT(inc(addr))
 #define uatomic_dec(addr)      UATOMIC_COMPAT(dec(addr))
 
@@ -486,4 +474,6 @@ extern unsigned long _compat_uatomic_xchg(void *addr,
 }
 #endif
 
+#include <urcu/uatomic_generic.h>
+
 #endif /* _URCU_ARCH_UATOMIC_X86_H */
This page took 0.032481 seconds and 4 git commands to generate.