Commit b7d317f5 authored by KaiGai Kohei's avatar KaiGai Kohei Committed by Linus Torvalds

[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: default avatarKaiGai, Kohei <kaigai@ak.jp.nec.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0f54531e
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment