aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asm-ia64/atomic.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/include/asm-ia64/atomic.h b/include/asm-ia64/atomic.h
index 569ec7574baf..b16ad235c7ee 100644
--- a/include/asm-ia64/atomic.h
+++ b/include/asm-ia64/atomic.h
@@ -88,12 +88,16 @@ ia64_atomic64_sub (__s64 i, atomic64_t *v)
88 return new; 88 return new;
89} 89}
90 90
91#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new)) 91#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new))
92#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 92#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
93 93
94#define atomic64_cmpxchg(v, old, new) \
95 (cmpxchg(&((v)->counter), old, new))
96#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
97
94#define atomic_add_unless(v, a, u) \ 98#define atomic_add_unless(v, a, u) \
95({ \ 99({ \
96 int c, old; \ 100 __typeof__(v->counter) c, old; \
97 c = atomic_read(v); \ 101 c = atomic_read(v); \
98 for (;;) { \ 102 for (;;) { \
99 if (unlikely(c == (u))) \ 103 if (unlikely(c == (u))) \
@@ -107,6 +111,22 @@ ia64_atomic64_sub (__s64 i, atomic64_t *v)
107}) 111})
108#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 112#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
109 113
114#define atomic64_add_unless(v, a, u) \
115({ \
116 __typeof__(v->counter) c, old; \
117 c = atomic64_read(v); \
118 for (;;) { \
119 if (unlikely(c == (u))) \
120 break; \
121 old = atomic64_cmpxchg((v), c, c + (a)); \
122 if (likely(old == c)) \
123 break; \
124 c = old; \
125 } \
126 c != (u); \
127})
128#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
129
110#define atomic_add_return(i,v) \ 130#define atomic_add_return(i,v) \
111({ \ 131({ \
112 int __ia64_aar_i = (i); \ 132 int __ia64_aar_i = (i); \