atomic: move atomic_add_unless to generic code
[deliverable/linux.git] / arch / sh / include / asm / atomic.h
index 8ddb2635cf9262d24e280f96aff4619c79d68df4..2177596d4b3804f26dc0398251d0bd1c08d4088d 100644 (file)
 #define atomic_cmpxchg(v, o, n)                (cmpxchg(&((v)->counter), (o), (n)))
 
 /**
- * atomic_add_unless - add unless the number is a given value
+ * __atomic_add_unless - add unless the number is a given value
  * @v: pointer of type atomic_t
  * @a: the amount to add to v...
  * @u: ...unless v is equal to u.
  *
  * Atomically adds @a to @v, so long as it was not @u.
- * Returns non-zero if @v was not @u, and zero otherwise.
+ * Returns the old value of @v.
  */
-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);
@@ -59,7 +59,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
                c = old;
        }
 
-       return c != (u);
+       return c;
 }
 
 #define smp_mb__before_atomic_dec()    smp_mb()
This page took 0.026289 seconds and 5 git commands to generate.