Merge tag 'v4.3-rc2' into topic/drm-misc
[deliverable/linux.git] / arch / x86 / include / asm / atomic.h
index e9168955c42f4ee8b18e726e28ecacf39b75a7f2..fb52aa644aabb4ed8ff15eb26dca1944648786c0 100644 (file)
@@ -182,6 +182,21 @@ static inline int atomic_xchg(atomic_t *v, int new)
        return xchg(&v->counter, new);
 }
 
+#define ATOMIC_OP(op)                                                  \
+static inline void atomic_##op(int i, atomic_t *v)                     \
+{                                                                      \
+       asm volatile(LOCK_PREFIX #op"l %1,%0"                           \
+                       : "+m" (v->counter)                             \
+                       : "ir" (i)                                      \
+                       : "memory");                                    \
+}
+
+ATOMIC_OP(and)
+ATOMIC_OP(or)
+ATOMIC_OP(xor)
+
+#undef ATOMIC_OP
+
 /**
  * __atomic_add_unless - add unless the number is already a given value
  * @v: pointer of type atomic_t
@@ -219,16 +234,6 @@ static __always_inline short int atomic_inc_short(short int *v)
        return *v;
 }
 
-/* These are x86-specific, used by some header files */
-#define atomic_clear_mask(mask, addr)                          \
-       asm volatile(LOCK_PREFIX "andl %0,%1"                   \
-                    : : "r" (~(mask)), "m" (*(addr)) : "memory")
-
-#define atomic_set_mask(mask, addr)                            \
-       asm volatile(LOCK_PREFIX "orl %0,%1"                    \
-                    : : "r" ((unsigned)(mask)), "m" (*(addr))  \
-                    : "memory")
-
 #ifdef CONFIG_X86_32
 # include <asm/atomic64_32.h>
 #else
This page took 0.026047 seconds and 5 git commands to generate.