aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include
diff options
context:
space:
mode:
authorArun Sharma <asharma@fb.com>2011-07-26 19:09:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-26 19:49:47 -0400
commitf24219b4e90cf70ec4a211b17fbabc725a0ddf3c (patch)
treec1c753bd425d61a5094995d9835b23b46383d9b2 /arch/sh/include
parent60063497a95e716c9a689af3be2687d261f115b4 (diff)
atomic: move atomic_add_unless to generic code
This is in preparation for more generic atomic primitives based on __atomic_add_unless. Signed-off-by: Arun Sharma <asharma@fb.com> Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: David Miller <davem@davemloft.net> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/sh/include')
-rw-r--r--arch/sh/include/asm/atomic.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h
index 8ddb2635cf92..2177596d4b38 100644
--- a/arch/sh/include/asm/atomic.h
+++ b/arch/sh/include/asm/atomic.h
@@ -38,15 +38,15 @@
38#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n))) 38#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
39 39
40/** 40/**
41 * atomic_add_unless - add unless the number is a given value 41 * __atomic_add_unless - add unless the number is a given value
42 * @v: pointer of type atomic_t 42 * @v: pointer of type atomic_t
43 * @a: the amount to add to v... 43 * @a: the amount to add to v...
44 * @u: ...unless v is equal to u. 44 * @u: ...unless v is equal to u.
45 * 45 *
46 * Atomically adds @a to @v, so long as it was not @u. 46 * Atomically adds @a to @v, so long as it was not @u.
47 * Returns non-zero if @v was not @u, and zero otherwise. 47 * Returns the old value of @v.
48 */ 48 */
49static inline int atomic_add_unless(atomic_t *v, int a, int u) 49static inline int __atomic_add_unless(atomic_t *v, int a, int u)
50{ 50{
51 int c, old; 51 int c, old;
52 c = atomic_read(v); 52 c = atomic_read(v);
@@ -59,7 +59,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
59 c = old; 59 c = old;
60 } 60 }
61 61
62 return c != (u); 62 return c;
63} 63}
64 64
65#define smp_mb__before_atomic_dec() smp_mb() 65#define smp_mb__before_atomic_dec() smp_mb()