lkml.org 
[lkml]   [2003]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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/

\
 
 \ /
  Last update: 2005-03-22 13:34    [W:0.016 / U:1.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site