[PATCH 2.4.20] added missing functions to include/asm-arm/atomic.h

From: Bart Trojanowski (bart@jukie.net)
Date: Tue Apr 22 2003 - 15:01:28 EST


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/



This archive was generated by hypermail 2b29 : Wed Apr 23 2003 - 22:00:34 EST