aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-cris
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-cris')
-rw-r--r--include/asm-cris/atomic.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/asm-cris/atomic.h b/include/asm-cris/atomic.h
index 45891f7de00f..683b05a57d88 100644
--- a/include/asm-cris/atomic.h
+++ b/include/asm-cris/atomic.h
@@ -136,6 +136,20 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
136 return ret; 136 return ret;
137} 137}
138 138
139static inline int atomic_add_unless(atomic_t *v, int a, int u)
140{
141 int ret;
142 unsigned long flags;
143
144 cris_atomic_save(v, flags);
145 ret = v->counter;
146 if (ret != u)
147 v->counter += a;
148 cris_atomic_restore(v, flags);
149 return ret != u;
150}
151#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
152
139/* Atomic operations are already serializing */ 153/* Atomic operations are already serializing */
140#define smp_mb__before_atomic_dec() barrier() 154#define smp_mb__before_atomic_dec() barrier()
141#define smp_mb__after_atomic_dec() barrier() 155#define smp_mb__after_atomic_dec() barrier()