patch-2.4.22 linux-2.4.22/include/asm-arm/atomic.h
Next file: linux-2.4.22/include/asm-arm/bitops.h
Previous file: linux-2.4.22/include/asm-arm/arch-tbox/system.h
Back to the patch index
Back to the overall index
- Lines: 104
- Date:
2003-08-25 04:44:43.000000000 -0700
- Orig file:
linux-2.4.21/include/asm-arm/atomic.h
- Orig date:
2001-10-11 09:04:57.000000000 -0700
diff -urN linux-2.4.21/include/asm-arm/atomic.h linux-2.4.22/include/asm-arm/atomic.h
@@ -32,75 +32,75 @@
#define atomic_read(v) ((v)->counter)
#define atomic_set(v,i) (((v)->counter) = (i))
-static __inline__ void atomic_add(int i, volatile atomic_t *v)
+static inline void atomic_add(int i, volatile atomic_t *v)
{
unsigned long flags;
- __save_flags_cli(flags);
+ local_irq_save(flags);
v->counter += i;
- __restore_flags(flags);
+ local_irq_restore(flags);
}
-static __inline__ void atomic_sub(int i, volatile atomic_t *v)
+static inline void atomic_sub(int i, volatile atomic_t *v)
{
unsigned long flags;
- __save_flags_cli(flags);
+ local_irq_save(flags);
v->counter -= i;
- __restore_flags(flags);
+ local_irq_restore(flags);
}
-static __inline__ void atomic_inc(volatile atomic_t *v)
+static inline void atomic_inc(volatile atomic_t *v)
{
unsigned long flags;
- __save_flags_cli(flags);
+ local_irq_save(flags);
v->counter += 1;
- __restore_flags(flags);
+ local_irq_restore(flags);
}
-static __inline__ void atomic_dec(volatile atomic_t *v)
+static inline void atomic_dec(volatile atomic_t *v)
{
unsigned long flags;
- __save_flags_cli(flags);
+ local_irq_save(flags);
v->counter -= 1;
- __restore_flags(flags);
+ local_irq_restore(flags);
}
-static __inline__ int atomic_dec_and_test(volatile atomic_t *v)
+static inline int atomic_dec_and_test(volatile atomic_t *v)
{
unsigned long flags;
- int result;
+ int val;
- __save_flags_cli(flags);
- v->counter -= 1;
- result = (v->counter == 0);
- __restore_flags(flags);
+ local_irq_save(flags);
+ val = v->counter;
+ v->counter = val -= 1;
+ local_irq_restore(flags);
- return result;
+ return val == 0;
}
static inline int atomic_add_negative(int i, volatile atomic_t *v)
{
unsigned long flags;
- int result;
+ int val;
- __save_flags_cli(flags);
- v->counter += i;
- result = (v->counter < 0);
- __restore_flags(flags);
+ local_irq_save(flags);
+ val = v->counter;
+ v->counter = val += i;
+ local_irq_restore(flags);
- return result;
+ return val < 0;
}
-static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long *addr)
+static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
{
unsigned long flags;
- __save_flags_cli(flags);
+ local_irq_save(flags);
*addr &= ~mask;
- __restore_flags(flags);
+ local_irq_restore(flags);
}
/* Atomic operations are already serializing on ARM */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)