diff options
author | Arun Sharma <asharma@fb.com> | 2011-07-26 19:09:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 19:49:47 -0400 |
commit | f24219b4e90cf70ec4a211b17fbabc725a0ddf3c (patch) | |
tree | c1c753bd425d61a5094995d9835b23b46383d9b2 /arch/sparc | |
parent | 60063497a95e716c9a689af3be2687d261f115b4 (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/sparc')
-rw-r--r-- | arch/sparc/include/asm/atomic_32.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/atomic_64.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h index 7646f2cef5d0..bdce95e77f85 100644 --- a/arch/sparc/include/asm/atomic_32.h +++ b/arch/sparc/include/asm/atomic_32.h | |||
@@ -22,7 +22,7 @@ | |||
22 | extern int __atomic_add_return(int, atomic_t *); | 22 | extern int __atomic_add_return(int, atomic_t *); |
23 | extern int atomic_cmpxchg(atomic_t *, int, int); | 23 | extern int atomic_cmpxchg(atomic_t *, int, int); |
24 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) | 24 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) |
25 | extern int atomic_add_unless(atomic_t *, int, int); | 25 | extern int __atomic_add_unless(atomic_t *, int, int); |
26 | extern void atomic_set(atomic_t *, int); | 26 | extern void atomic_set(atomic_t *, int); |
27 | 27 | ||
28 | #define atomic_read(v) (*(volatile int *)&(v)->counter) | 28 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h index 337139ef91be..1fc3d0a62d66 100644 --- a/arch/sparc/include/asm/atomic_64.h +++ b/arch/sparc/include/asm/atomic_64.h | |||
@@ -70,7 +70,7 @@ extern long atomic64_sub_ret(long, atomic64_t *); | |||
70 | #define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n))) | 70 | #define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n))) |
71 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) | 71 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) |
72 | 72 | ||
73 | static inline int atomic_add_unless(atomic_t *v, int a, int u) | 73 | static inline int __atomic_add_unless(atomic_t *v, int a, int u) |
74 | { | 74 | { |
75 | int c, old; | 75 | int c, old; |
76 | c = atomic_read(v); | 76 | c = atomic_read(v); |
@@ -82,7 +82,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u) | |||
82 | break; | 82 | break; |
83 | c = old; | 83 | c = old; |
84 | } | 84 | } |
85 | return c != (u); | 85 | return c; |
86 | } | 86 | } |
87 | 87 | ||
88 | 88 | ||