aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-cris/atomic.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-cris/atomic.h')
-rw-r--r--include/asm-cris/atomic.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/asm-cris/atomic.h b/include/asm-cris/atomic.h
index 8c2e78304523..45891f7de00f 100644
--- a/include/asm-cris/atomic.h
+++ b/include/asm-cris/atomic.h
@@ -123,6 +123,19 @@ static inline int atomic_inc_and_test(volatile atomic_t *v)
123 return retval; 123 return retval;
124} 124}
125 125
126static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
127{
128 int ret;
129 unsigned long flags;
130
131 cris_atomic_save(v, flags);
132 ret = v->counter;
133 if (likely(ret == old))
134 v->counter = new;
135 cris_atomic_restore(v, flags);
136 return ret;
137}
138
126/* Atomic operations are already serializing */ 139/* Atomic operations are already serializing */
127#define smp_mb__before_atomic_dec() barrier() 140#define smp_mb__before_atomic_dec() barrier()
128#define smp_mb__after_atomic_dec() barrier() 141#define smp_mb__after_atomic_dec() barrier()