diff options
| author | KaiGai Kohei <kaigai@ak.jp.nec.com> | 2004-10-19 18:13:58 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-19 18:13:58 -0700 |
| commit | b7d317f5cca47313741561ffeacf4c55ade5e10e (patch) | |
| tree | ced4013fee06bd895aa43428d5ca6f60b7b2dade /include | |
| parent | 0f54531e41e254893e32c6744d277fd1f4e722b9 (diff) | |
[PATCH] atomic_inc_return() for arm26
This patch implements atomic_inc_return() and so on for ARM26. Because
Hugh says that SMP is not supported in arm26, it is implemented by normal
operations between local_irq_save() and local_irq_restore() like another
atomic operations.
Signed-off-by: KaiGai, Kohei <kaigai@ak.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-arm26/atomic.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/asm-arm26/atomic.h b/include/asm-arm26/atomic.h index 5697fc898593..56fa1a3038fa 100644 --- a/include/asm-arm26/atomic.h +++ b/include/asm-arm26/atomic.h @@ -105,6 +105,27 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr) local_irq_restore(flags); } +static inline int atomic_add_return(int i, volatile atomic_t *v) +{ + unsigned long flags; + int val; + + local_irq_save(flags); + val = v->counter + i; + v->counter = val; + local_irq_restore(flags); + + return val; +} + +static inline int atomic_sub_return(int i, volatile atomic_t *v) +{ + return atomic_add_return(-i, v); +} + +#define atomic_inc_return(v) (atomic_add_return(1,v)) +#define atomic_dec_return(v) (atomic_sub_return(1,v)) + /* Atomic operations are already serializing on ARM */ #define smp_mb__before_atomic_dec() barrier() #define smp_mb__after_atomic_dec() barrier() |
