diff options
Diffstat (limited to 'arch/sparc/lib/atomic32.c')
-rw-r--r-- | arch/sparc/lib/atomic32.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c index be46f6545184..cb3cf0f22822 100644 --- a/arch/sparc/lib/atomic32.c +++ b/arch/sparc/lib/atomic32.c | |||
@@ -53,6 +53,21 @@ int atomic_cmpxchg(atomic_t *v, int old, int new) | |||
53 | return ret; | 53 | return ret; |
54 | } | 54 | } |
55 | 55 | ||
56 | int atomic_add_unless(atomic_t *v, int a, int u) | ||
57 | { | ||
58 | int ret; | ||
59 | unsigned long flags; | ||
60 | |||
61 | spin_lock_irqsave(ATOMIC_HASH(v), flags); | ||
62 | ret = v->counter; | ||
63 | if (ret != u) | ||
64 | v->counter += a; | ||
65 | spin_unlock_irqrestore(ATOMIC_HASH(v), flags); | ||
66 | return ret != u; | ||
67 | } | ||
68 | |||
69 | static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr) | ||
70 | /* Atomic operations are already serializing */ | ||
56 | void atomic_set(atomic_t *v, int i) | 71 | void atomic_set(atomic_t *v, int i) |
57 | { | 72 | { |
58 | unsigned long flags; | 73 | unsigned long flags; |