diff options
Diffstat (limited to 'include/asm-arm26/atomic.h')
-rw-r--r-- | include/asm-arm26/atomic.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/asm-arm26/atomic.h b/include/asm-arm26/atomic.h index 54b24ead7132..a47cadc59686 100644 --- a/include/asm-arm26/atomic.h +++ b/include/asm-arm26/atomic.h | |||
@@ -76,6 +76,21 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new) | |||
76 | return ret; | 76 | return ret; |
77 | } | 77 | } |
78 | 78 | ||
79 | static inline int atomic_add_unless(atomic_t *v, int a, int u) | ||
80 | { | ||
81 | int ret; | ||
82 | unsigned long flags; | ||
83 | |||
84 | local_irq_save(flags); | ||
85 | ret = v->counter; | ||
86 | if (ret != u) | ||
87 | v->counter += a; | ||
88 | local_irq_restore(flags); | ||
89 | |||
90 | return ret != u; | ||
91 | } | ||
92 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | ||
93 | |||
79 | static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr) | 94 | static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr) |
80 | { | 95 | { |
81 | unsigned long flags; | 96 | unsigned long flags; |