atomic: move atomic_add_unless to generic code
[firefly-linux-kernel-4.4.55.git] / include / asm-generic / atomic.h
index 7f84414c5f533e2d70f3f59499b8a1e62b17919e..bd18bfd78e9be2d9730b02c1a943ad16e556eb59 100644 (file)
@@ -129,13 +129,13 @@ static inline void atomic_dec(atomic_t *v)
 
 #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
 
-static inline int atomic_add_unless(atomic_t *v, int a, int u)
+static inline int __atomic_add_unless(atomic_t *v, int a, int u)
 {
   int c, old;
   c = atomic_read(v);
   while (c != u && (old = atomic_cmpxchg(v, c, c + a)) != c)
     c = old;
-  return c != u;
+  return c;
 }
 
 static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)