summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-06-02 10:54:04 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-06-03 10:03:33 +0200
commit606dff6ef4190ed1833aa9569ce7464968d46820 (patch)
treef673d47854ea649e6ab251383a6ece3fdac42ab1 /include
parent386db316df56ea65db89335d6523dd4719933586 (diff)
downloadbarebox-606dff6ef4190ed1833aa9569ce7464968d46820.tar.gz
barebox-606dff6ef4190ed1833aa9569ce7464968d46820.tar.xz
include: <asm-generic/atomic.h>: remove stub IRQ save/restore
For an architecture to use <asm-generic/atomic.h>, it must define local_irq_save() and local_irq_restore(). Instead of having every platform define duplicate their stub definition, just drop them altogether, so <asm-generic/atomic.h> can be used freestanding. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/atomic.h26
1 files changed, 0 insertions, 26 deletions
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 6357b66a53..449cecaabc 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -21,73 +21,47 @@ typedef struct { volatile int counter; } atomic_t;
static inline void atomic_add(int i, volatile atomic_t *v)
{
- unsigned long flags = 0;
-
- local_irq_save(flags);
v->counter += i;
- local_irq_restore(flags);
}
static inline void atomic_sub(int i, volatile atomic_t *v)
{
- unsigned long flags = 0;
-
- local_irq_save(flags);
v->counter -= i;
- local_irq_restore(flags);
}
static inline void atomic_inc(volatile atomic_t *v)
{
- unsigned long flags = 0;
-
- local_irq_save(flags);
v->counter += 1;
- local_irq_restore(flags);
}
static inline void atomic_dec(volatile atomic_t *v)
{
- unsigned long flags = 0;
-
- local_irq_save(flags);
v->counter -= 1;
- local_irq_restore(flags);
}
static inline int atomic_dec_and_test(volatile atomic_t *v)
{
- unsigned long flags = 0;
int val;
- local_irq_save(flags);
val = v->counter;
v->counter = val -= 1;
- local_irq_restore(flags);
return val == 0;
}
static inline int atomic_add_negative(int i, volatile atomic_t *v)
{
- unsigned long flags = 0;
int val;
- local_irq_save(flags);
val = v->counter;
v->counter = val += i;
- local_irq_restore(flags);
return val < 0;
}
static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
{
- unsigned long flags = 0;
-
- local_irq_save(flags);
*addr &= ~mask;
- local_irq_restore(flags);
}
/* Atomic operations are already serializing on ARM */