[PATCH v2 17/25] include: <asm-generic/atomic.h>: remove stub IRQ save/restore

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 include/asm-generic/atomic.h | 26 --------------------------
 1 file changed, 26 deletions(-)

diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 6357b66a5304..449cecaabc74 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 */
-- 
2.27.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux