mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kaigai@ak.jp.nec.com (Kaigai Kohei)
To: akpm@osdl.org, hugh@veritas.com, spyro@f2s.com
Cc: wli@holomorphy.com, takata.hirokazu@renesas.com,
	kaigai@ak.jp.nec.com, linux-kernel@vger.kernel.org
Subject: [PATCH] atomic_inc_return() for arm26[1/5] (Re: atomic_inc_return)
Date: Fri, 10 Sep 2004 12:30:15 +0900 (JST)	[thread overview]
Message-ID: <200409100330.i8A3UFYV007120@mailsv.bs1.fc.nec.co.jp> (raw)
In-Reply-To: Your message of "Thu, 9 Sep 2004 20:48:27 +0100 (BST)". <Pine.LNX.4.44.0409092005430.14004-100000@localhost.localdomain>


[4/5] atomic_inc_return-linux-2.6.9-rc1.arm26.patch
  This patch implements atomic_inc_return() and so on for ARM26.
  Because Hugh says that SMP is not supported in arm26, it is implemented
  by normal operations between local_irq_save() and local_irq_restore()
  like another atomic operations.
  This patch has not been tested, since we don't have ARM26 machine.
  I want to let this reviewed by ARM26 specialists.

Signed-off-by: KaiGai, Kohei <kaigai@ak.jp.nec.com>
--------
Kai Gai <kaigai@ak.jp.nec.com>


diff -rNU4 linux-2.6.9-rc1/include/asm-arm26/atomic.h linux-2.6.9-rc1.atomic_inc_return/include/asm-arm26/atomic.h
--- linux-2.6.9-rc1/include/asm-arm26/atomic.h	2004-08-24 16:02:32.000000000 +0900
+++ linux-2.6.9-rc1.atomic_inc_return/include/asm-arm26/atomic.h	2004-09-10 10:20:29.000000000 +0900
@@ -104,8 +104,29 @@
 	*addr &= ~mask;
 	local_irq_restore(flags);
 }
 
+static inline int atomic_add_return(int i, volatile atomic_t *v)
+{
+	unsigned long flags;
+	int val;
+
+	local_irq_save(flags);
+	val = v->counter + i;
+	v->counter = val;
+	local_irq_restore(flags);
+
+	return val;
+}
+
+static inline int atomic_sub_return(int i, volatile atomic_t *v)
+{
+	return atomic_add_return(-i, v);
+}
+
+#define atomic_inc_return(v)  (atomic_add_return(1,v))
+#define atomic_dec_return(v)  (atomic_sub_return(1,v))
+
 /* Atomic operations are already serializing on ARM */
 #define smp_mb__before_atomic_dec()	barrier()
 #define smp_mb__after_atomic_dec()	barrier()
 #define smp_mb__before_atomic_inc()	barrier()

  parent reply	other threads:[~2004-09-10  3:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.44.0409092005430.14004-100000@localhost.localdomain>
2004-09-10  3:26 ` [PATCH] atomic_inc_return() for i386[1/5] " Kaigai Kohei
2004-09-10  5:34   ` Chris Wedgwood
2004-09-11 23:05   ` Andrew Morton
2004-09-12  8:25     ` Andi Kleen
2004-09-12  9:06       ` Andrew Morton
2004-09-10  3:27 ` [PATCH] atomic_inc_return() for x86_64[2/5] " Kaigai Kohei
2004-09-10  3:29 ` [PATCH] atomic_inc_return() for arm[3/5] " Kaigai Kohei
2004-09-10  3:30 ` Kaigai Kohei [this message]
2004-09-10  3:32 ` [PATCH] atomic_inc_return() for sparc64[5/5] " Kaigai Kohei
2004-09-10  5:26   ` David S. Miller
2004-09-10  4:05 ` PATCH] atomic_inc_return() [0/5] " Kaigai Kohei
2004-09-10  6:37   ` Hugh Dickins

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=200409100330.i8A3UFYV007120@mailsv.bs1.fc.nec.co.jp \
    --to=kaigai@ak.jp.nec.com \
    --cc=akpm@osdl.org \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spyro@f2s.com \
    --cc=takata.hirokazu@renesas.com \
    --cc=wli@holomorphy.com \
    /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®