Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Tue, 22 Apr 2003 16:01:28 -0400 | From | Bart Trojanowski <> | Subject | [PATCH 2.4.20] added missing functions to include/asm-arm/atomic.h |
| |
While porting a piece of code from i386 to arm, I've noticed that two atomic operations are missing from the asm-arm/atomic.h interface.
The patch below adds these two missing functions with an aim of filling in the compatibility hole.
Regards, Bart.
--- linux-2.4.20/include/asm-arm/atomic.h.orig Tue Apr 22 15:37:48 2003 +++ linux-2.4.20/include/asm-arm/atomic.h Tue Apr 22 15:42:23 2003 @@ -68,6 +68,32 @@ __restore_flags(flags); } +static __inline__ int atomic_sub_and_test(int i, volatile atomic_t *v) +{ + unsigned long flags; + int result; + + __save_flags_cli(flags); + v->counter -= i; + result = (v->counter == 0); + __restore_flags(flags); + + return result; +} + +static __inline__ int atomic_inc_and_test(volatile atomic_t *v) +{ + unsigned long flags; + int result; + + __save_flags_cli(flags); + v->counter += 1; + result = (v->counter == 0); + __restore_flags(flags); + + return result; +} + static __inline__ int atomic_dec_and_test(volatile atomic_t *v) { unsigned long flags; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |