mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Trojanowski <bart@jukie.net>
To: linux-kernel@vger.kernel.org
Cc: kernel-janitor-discuss@lists.sourceforge.net, trivial@rustcorp.com.au
Subject: [PATCH 2.4.20] added missing functions to include/asm-arm/atomic.h
Date: Tue, 22 Apr 2003 16:01:28 -0400	[thread overview]
Message-ID: <20030422160128.G1364@jukie.net> (raw)

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;


                 reply	other threads:[~2003-04-22 19:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030422160128.G1364@jukie.net \
    --to=bart@jukie.net \
    --cc=kernel-janitor-discuss@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trivial@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®