netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 17/24] make atomic_read() behave consistently on sh64
@ 2007-08-09 14:09 ` Chris Snook
  2007-08-09 16:40   ` Paul Mundt
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Snook @ 2007-08-09 14:09 UTC (permalink / raw)
  To: linux-kernel, linux-arch, torvalds
  Cc: netdev, akpm, ak, heiko.carstens, davem, schwidefsky, wensong,
	horms, wjiang, cfriesen, zlynx, rpjday, jesper.juhl

From: Chris Snook <csnook@redhat.com>

Purify volatile use for atomic_t on sh64.

Signed-off-by: Chris Snook <csnook@redhat.com>

--- linux-2.6.23-rc2-orig/include/asm-sh64/atomic.h	2007-07-08 19:32:17.000000000 -0400
+++ linux-2.6.23-rc2/include/asm-sh64/atomic.h	2007-08-09 07:22:50.000000000 -0400
@@ -19,11 +19,15 @@
  *
  */
 
-typedef struct { volatile int counter; } atomic_t;
+typedef struct { int counter; } atomic_t;
 
 #define ATOMIC_INIT(i)	( (atomic_t) { (i) } )
 
-#define atomic_read(v)		((v)->counter)
+/*
+ * Casting to volatile here minimizes the need for barriers,
+ * without having to declare the type itself as volatile.
+ */
+#define atomic_read(v)		(*(volatile int *)&(v)->counter)
 #define atomic_set(v,i)		((v)->counter = (i))
 
 #include <asm/system.h>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 18/24] make atomic_read() behave consistently on sh
@ 2007-08-09 14:10 Chris Snook
  2007-08-09 14:09 ` [PATCH 17/24] make atomic_read() behave consistently on sh64 Chris Snook
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Snook @ 2007-08-09 14:10 UTC (permalink / raw)
  To: linux-kernel, linux-arch, torvalds
  Cc: netdev, akpm, ak, heiko.carstens, davem, schwidefsky, wensong,
	horms, wjiang, cfriesen, zlynx, rpjday, jesper.juhl

From: Chris Snook <csnook@redhat.com>

Purify volatile use for atomic_t on sh.

Signed-off-by: Chris Snook <csnook@redhat.com>

--- linux-2.6.23-rc2-orig/include/asm-sh/atomic.h	2007-07-08 19:32:17.000000000 -0400
+++ linux-2.6.23-rc2/include/asm-sh/atomic.h	2007-08-09 07:21:33.000000000 -0400
@@ -7,11 +7,15 @@
  *
  */
 
-typedef struct { volatile int counter; } atomic_t;
+typedef struct { int counter; } atomic_t;
 
 #define ATOMIC_INIT(i)	( (atomic_t) { (i) } )
 
-#define atomic_read(v)		((v)->counter)
+/*
+ * Casting to volatile here minimizes the need for barriers,
+ * without having to declare the type itself as volatile.
+ */
+#define atomic_read(v)		(*(volatile int *)&(v)->counter)
 #define atomic_set(v,i)		((v)->counter = (i))
 
 #include <linux/compiler.h>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 17/24] make atomic_read() behave consistently on sh64
  2007-08-09 14:09 ` [PATCH 17/24] make atomic_read() behave consistently on sh64 Chris Snook
@ 2007-08-09 16:40   ` Paul Mundt
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Mundt @ 2007-08-09 16:40 UTC (permalink / raw)
  To: Chris Snook
  Cc: linux-kernel, linux-arch, torvalds, netdev, akpm, ak,
	heiko.carstens, davem, schwidefsky, wensong, horms, wjiang,
	cfriesen, zlynx, rpjday, jesper.juhl

On Thu, Aug 09, 2007 at 10:09:08AM -0400, Chris Snook wrote:
> Purify volatile use for atomic_t on sh64.
> 
> Signed-off-by: Chris Snook <csnook@redhat.com>

On Thu, Aug 09, 2007 at 10:10:34AM -0400, Chris Snook wrote:
> Purify volatile use for atomic_t on sh.
> 
> Signed-off-by: Chris Snook <csnook@redhat.com>

Acked-by: Paul Mundt <lethal@linux-sh.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-09 16:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-09 14:10 [PATCH 18/24] make atomic_read() behave consistently on sh Chris Snook
2007-08-09 14:09 ` [PATCH 17/24] make atomic_read() behave consistently on sh64 Chris Snook
2007-08-09 16:40   ` Paul Mundt

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).