aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
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/sparc
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/sparc')
-rw-r--r--arch/sparc/include/asm/atomic_32.h2
-rw-r--r--arch/sparc/include/asm/atomic_64.h4
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 @@
22extern int __atomic_add_return(int, atomic_t *); 22extern int __atomic_add_return(int, atomic_t *);
23extern int atomic_cmpxchg(atomic_t *, int, int); 23extern 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))
25extern int atomic_add_unless(atomic_t *, int, int); 25extern int __atomic_add_unless(atomic_t *, int, int);
26extern void atomic_set(atomic_t *, int); 26extern 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
73static inline int atomic_add_unless(atomic_t *v, int a, int u) 73static 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