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/mn10300 | |
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/mn10300')
-rw-r--r-- | arch/mn10300/include/asm/atomic.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/mn10300/include/asm/atomic.h b/arch/mn10300/include/asm/atomic.h index 041b9d69d86..a2e6759af4d 100644 --- a/arch/mn10300/include/asm/atomic.h +++ b/arch/mn10300/include/asm/atomic.h | |||
@@ -260,13 +260,13 @@ static inline void atomic_dec(atomic_t *v) | |||
260 | #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) | 260 | #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) |
261 | #define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) | 261 | #define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) |
262 | 262 | ||
263 | #define atomic_add_unless(v, a, u) \ | 263 | #define __atomic_add_unless(v, a, u) \ |
264 | ({ \ | 264 | ({ \ |
265 | int c, old; \ | 265 | int c, old; \ |
266 | c = atomic_read(v); \ | 266 | c = atomic_read(v); \ |
267 | while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ | 267 | while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ |
268 | c = old; \ | 268 | c = old; \ |
269 | c != (u); \ | 269 | c; \ |
270 | }) | 270 | }) |
271 | 271 | ||
272 | 272 | ||