linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Chris Snook <csnook@redhat.com>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	akpm@linux-foundation.org, paulmck@linux.vnet.ibm.com,
	Segher Boessenkool <segher@kernel.crashing.org>,
	"Luck, Tony" <tony.luck@intel.com>,
	Chris Friesen <cfriesen@nortel.com>,
	"Robert P. J. Day" <rpjday@mindspring.com>
Subject: Re: [PATCH 3/23] make atomic_read() and atomic_set() behavior consistent on arm
Date: Mon, 13 Aug 2007 13:59:45 +0100	[thread overview]
Message-ID: <20070813125944.GB9165@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20070813124652.GA2805@shell.boston.redhat.com>

On Mon, Aug 13, 2007 at 08:46:52AM -0400, Chris Snook wrote:
> On Mon, Aug 13, 2007 at 01:19:31PM +0100, Russell King wrote:
> > On Mon, Aug 13, 2007 at 07:09:46AM -0400, Chris Snook wrote:
> > > By popular demand, I've redone the patchset to include volatile casts in
> > > atomic_set as well.  I've also converted the macros to inline functions, to
> > > help catch type mismatches at compile time.
> > 
> > and in the rest of include/asm-arm/atomic.h:
> > 
> > #else /* ARM_ARCH_6 */
> > 
> > #include <asm/system.h>
> > 
> > #ifdef CONFIG_SMP
> > #error SMP not supported on pre-ARMv6 CPUs
> > #endif
> > 
> > #define atomic_set(v,i) (((v)->counter) = (i))
> > 
> > Seems you missed that.  Grep is a wonderful tool.
> 
> D'oh!  Try this.

Thanks.

Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>

> --- linux-2.6.23-rc3-orig/include/asm-arm/atomic.h	2007-07-08 19:32:17.000000000 -0400
> +++ linux-2.6.23-rc3/include/asm-arm/atomic.h	2007-08-13 08:39:52.000000000 -0400
> @@ -14,13 +14,16 @@
>  #include <linux/compiler.h>
>  #include <asm/system.h>
>  
> -typedef struct { volatile int counter; } atomic_t;
> +typedef struct { int counter; } atomic_t;
>  
>  #define ATOMIC_INIT(i)	{ (i) }
>  
>  #ifdef __KERNEL__
>  
> -#define atomic_read(v)	((v)->counter)
> +static inline int atomic_read(atomic_t *v)
> +{
> +        return *(volatile int *)&v->counter;
> +}
>  
>  #if __LINUX_ARM_ARCH__ >= 6
>  
> @@ -122,7 +125,10 @@ static inline void atomic_clear_mask(uns
>  #error SMP not supported on pre-ARMv6 CPUs
>  #endif
>  
> -#define atomic_set(v,i)	(((v)->counter) = (i))
> +static inline void atomic_set(atomic_t *v, int i)
> +{
> +        *(volatile int *)&v->counter = i;
> +}
>  
>  static inline int atomic_add_return(int i, atomic_t *v)
>  {
> -
> To unsubscribe from this list: send the line "unsubscribe linux-arch" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:

  reply	other threads:[~2007-08-13 13:00 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-13 10:55 [PATCH 0/23] make atomic_read() and atomic_set() behavior consistent across all architectures Chris Snook
2007-08-13 11:04 ` [PATCH 1/23] document preferred use of volatile with atomic_t Chris Snook
2007-08-13 23:54   ` Paul E. McKenney
2007-08-14 22:45   ` Christoph Lameter
2007-08-14 22:53     ` Chris Snook
2007-08-14 22:56       ` Christoph Lameter
2007-08-14 23:25         ` Chris Snook
2007-08-14 23:28         ` Paul E. McKenney
2007-08-16 21:36       ` Segher Boessenkool
2007-08-13 11:06 ` [PATCH 2/23] make atomic_read() and atomic_set() behavior consistent on alpha Chris Snook
2007-08-13 11:09 ` [PATCH 3/23] make atomic_read() and atomic_set() behavior consistent on arm Chris Snook
2007-08-13 12:19   ` Russell King
2007-08-13 12:46     ` Chris Snook
2007-08-13 12:59       ` Russell King [this message]
2007-08-13 11:11 ` [PATCH 4/23] make atomic_read() and atomic_set() behavior consistent on avr32 Chris Snook
2007-08-13 11:12 ` [PATCH 5/23] make atomic_read() and atomic_set() behavior consistent on blackfin Chris Snook
2007-08-13 11:14 ` [PATCH 6/23] make atomic_read() and atomic_set() behavior consistent on cris Chris Snook
2007-08-13 11:15 ` [PATCH 7/23] make atomic_read() and atomic_set() behavior consistent on frv Chris Snook
2007-08-13 11:18 ` [PATCH 8/23] make atomic_read() and atomic_set() behavior consistent on h8300 Chris Snook
2007-08-13 11:21 ` [PATCH 9/23] make atomic_read() and atomic_set() behavior consistent on i386 Chris Snook
2007-08-13 11:23 ` [PATCH 10/23] make atomic_read() and atomic_set() behavior consistent on ia64 Chris Snook
2007-08-14 18:27   ` Luck, Tony
2007-08-14 18:48     ` Chris Snook
2007-08-14 22:06       ` Luck, Tony
2007-08-14 22:11         ` Christoph Lameter
2007-08-14 22:21           ` Chris Snook
2007-08-13 11:24 ` [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r Chris Snook
2007-08-22  1:56   ` Hirokazu Takata
2007-08-22  5:00     ` Hirokazu Takata
2007-08-22 14:06       ` Chris Snook
2007-08-22 14:24         ` Segher Boessenkool
2007-08-22 18:20           ` Linus Torvalds
2007-08-23 19:29             ` Segher Boessenkool
2007-08-23 20:12               ` Linus Torvalds
2007-08-23 20:40               ` Valdis.Kletnieks
2007-08-23 20:05             ` David Howells
2007-08-13 11:26 ` [PATCH 12/23] make atomic_read() and atomic_set() behavior consistent on m68knommu Chris Snook
2007-08-13 11:28 ` [PATCH 13/23] make atomic_read() and atomic_set() behavior consistent on m68k Chris Snook
2007-08-13 11:29 ` [PATCH 14/23] make atomic_read() and atomic_set() behavior consistent on mips Chris Snook
2007-08-13 11:31 ` [PATCH 15/23] make atomic_read() and atomic_set() behavior consistent on parisc Chris Snook
2007-08-13 11:33 ` [PATCH 16/23] make atomic_read() and atomic_set() behavior consistent on s390 Chris Snook
2007-08-13 11:34 ` [PATCH 17/23] make atomic_read() and atomic_set() behavior consistent on sh64 Chris Snook
2007-08-13 11:36 ` [PATCH 18/23] make atomic_read() and atomic_set() behavior consistent on sh Chris Snook
2007-08-13 11:40 ` [PATCH 19/23] make atomic_read() and atomic_set() behavior consistent on sparc64 Chris Snook
2007-08-13 11:42 ` [PATCH 20/23] make atomic_read() and atomic_set() behavior consistent on sparc Chris Snook
2007-08-13 11:43 ` [PATCH 21/23] make atomic_read() and atomic_set() behavior consistent on v850 Chris Snook
2007-08-13 11:44 ` [PATCH 22/23] make atomic_read() and atomic_set() behavior consistent on x86_64 Chris Snook
2007-08-13 11:45 ` [PATCH 23/23] make atomic_read() and atomic_set() behavior consistent on xtensa Chris Snook
2007-08-14  9:42 ` [PATCH 7/23] make atomic_read() and atomic_set() behavior consistent on frv David Howells

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=20070813125944.GB9165@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=cfriesen@nortel.com \
    --cc=csnook@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rpjday@mindspring.com \
    --cc=segher@kernel.crashing.org \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).