linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.4.20] added missing functions to include/asm-arm/atomic.h
@ 2003-04-22 20:01 Bart Trojanowski
  0 siblings, 0 replies; only message in thread
From: Bart Trojanowski @ 2003-04-22 20:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitor-discuss, trivial

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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-04-22 19:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-22 20:01 [PATCH 2.4.20] added missing functions to include/asm-arm/atomic.h Bart Trojanowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).