1 #ifndef __ASM_SH_ATOMIC_IRQ_H
2 #define __ASM_SH_ATOMIC_IRQ_H
4 #include <linux/irqflags.h>
7 * To get proper branch prediction for the main line, we must branch
8 * forward to code at the end of this object's .text section, then
9 * branch back to restart the operation.
12 #define ATOMIC_OP(op, c_op) \
13 static inline void atomic_##op(int i, atomic_t *v) \
15 unsigned long flags; \
17 raw_local_irq_save(flags); \
19 raw_local_irq_restore(flags); \
22 #define ATOMIC_OP_RETURN(op, c_op) \
23 static inline int atomic_##op##_return(int i, atomic_t *v) \
25 unsigned long temp, flags; \
27 raw_local_irq_save(flags); \
31 raw_local_irq_restore(flags); \
36 #define ATOMIC_FETCH_OP(op, c_op) \
37 static inline int atomic_fetch_##op(int i, atomic_t *v) \
39 unsigned long temp, flags; \
41 raw_local_irq_save(flags); \
44 raw_local_irq_restore(flags); \
49 #define ATOMIC_OPS(op, c_op) \
51 ATOMIC_OP_RETURN(op, c_op) \
52 ATOMIC_FETCH_OP(op, c_op)
58 #define ATOMIC_OPS(op, c_op) \
60 ATOMIC_FETCH_OP(op, c_op)
67 #undef ATOMIC_FETCH_OP
68 #undef ATOMIC_OP_RETURN
71 #endif /* __ASM_SH_ATOMIC_IRQ_H */