drm: Add atomic_cmpxchg()
authorFrançois Tigeot <ftigeot@wolfpond.org>
Sat, 31 Oct 2015 09:02:16 +0000 (10:02 +0100)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Sat, 31 Oct 2015 09:24:09 +0000 (10:24 +0100)
sys/dev/drm/include/linux/atomic.h

index ca296cd..f04b38a 100644 (file)
@@ -119,6 +119,11 @@ atomic_dec(atomic_t *v)
        return atomic_fetchadd_int(&v->counter, -1) - 1;
 }
 
+static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
+{
+       return atomic_cmpxchg_int(&v->counter, old, new);
+}
+
 static inline int atomic_add_unless(atomic_t *v, int add, int unless)
 {
         int c, old;
@@ -126,7 +131,6 @@ static inline int atomic_add_unless(atomic_t *v, int add, int unless)
         for (;;) {
                 if (unlikely(c == unless))
                         break;
-                // old = atomic_cmpxchg((v), c, c + (a)); /*Linux*/
                 old = atomic_cmpxchg_int(&v->counter, c, c + add);
                 if (likely(old == c))
                         break;