diff options
author | Anton Blanchard <anton@samba.org> | 2010-05-17 00:33:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-17 10:57:27 -0400 |
commit | f3d46f9d3194e0329216002a8724d4c0957abc79 (patch) | |
tree | 6d9413e4a448d7b8d342c40297c4fbe0b9c4c2f0 /arch | |
parent | e40152ee1e1c7a63f4777791863215e3faa37a86 (diff) |
atomic_t: Cast to volatile when accessing atomic variables
In preparation for removing volatile from the atomic_t definition, this
patch adds a volatile cast to all the atomic read functions.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/include/asm/atomic.h | 4 | ||||
-rw-r--r-- | arch/arm/include/asm/atomic.h | 2 | ||||
-rw-r--r-- | arch/avr32/include/asm/atomic.h | 2 | ||||
-rw-r--r-- | arch/cris/include/asm/atomic.h | 2 | ||||
-rw-r--r-- | arch/frv/include/asm/atomic.h | 2 | ||||
-rw-r--r-- | arch/h8300/include/asm/atomic.h | 2 | ||||
-rw-r--r-- | arch/ia64/include/asm/atomic.h | 4 | ||||
-rw-r--r-- | arch/m32r/include/asm/atomic.h | 2 | ||||
-rw-r--r-- | arch/m68k/include/asm/atomic_mm.h | 2 | ||||
-rw-r--r-- | arch/m68k/include/asm/atomic_no.h | 2 | ||||
-rw-r--r-- | arch/mips/include/asm/atomic.h | 4 | ||||
-rw-r--r-- | arch/mn10300/include/asm/atomic.h | 2 | ||||
-rw-r--r-- | arch/parisc/include/asm/atomic.h | 4 | ||||
-rw-r--r-- | arch/sh/include/asm/atomic.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/atomic_32.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/atomic_64.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/atomic.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/atomic64_64.h | 2 | ||||
-rw-r--r-- | arch/xtensa/include/asm/atomic.h | 2 |
19 files changed, 24 insertions, 24 deletions
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h index 610dff44d94b..e756d04b6cd5 100644 --- a/arch/alpha/include/asm/atomic.h +++ b/arch/alpha/include/asm/atomic.h | |||
@@ -17,8 +17,8 @@ | |||
17 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) | 17 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) |
18 | #define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } ) | 18 | #define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } ) |
19 | 19 | ||
20 | #define atomic_read(v) ((v)->counter + 0) | 20 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
21 | #define atomic64_read(v) ((v)->counter + 0) | 21 | #define atomic64_read(v) (*(volatile long *)&(v)->counter) |
22 | 22 | ||
23 | #define atomic_set(v,i) ((v)->counter = (i)) | 23 | #define atomic_set(v,i) ((v)->counter = (i)) |
24 | #define atomic64_set(v,i) ((v)->counter = (i)) | 24 | #define atomic64_set(v,i) ((v)->counter = (i)) |
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h index e8ddec2cb158..a0162fa94564 100644 --- a/arch/arm/include/asm/atomic.h +++ b/arch/arm/include/asm/atomic.h | |||
@@ -24,7 +24,7 @@ | |||
24 | * strex/ldrex monitor on some implementations. The reason we can use it for | 24 | * strex/ldrex monitor on some implementations. The reason we can use it for |
25 | * atomic_set() is the clrex or dummy strex done on every exception return. | 25 | * atomic_set() is the clrex or dummy strex done on every exception return. |
26 | */ | 26 | */ |
27 | #define atomic_read(v) ((v)->counter) | 27 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
28 | #define atomic_set(v,i) (((v)->counter) = (i)) | 28 | #define atomic_set(v,i) (((v)->counter) = (i)) |
29 | 29 | ||
30 | #if __LINUX_ARM_ARCH__ >= 6 | 30 | #if __LINUX_ARM_ARCH__ >= 6 |
diff --git a/arch/avr32/include/asm/atomic.h b/arch/avr32/include/asm/atomic.h index b131c27ddf57..bbce6a1c6bb6 100644 --- a/arch/avr32/include/asm/atomic.h +++ b/arch/avr32/include/asm/atomic.h | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | #define ATOMIC_INIT(i) { (i) } | 20 | #define ATOMIC_INIT(i) { (i) } |
21 | 21 | ||
22 | #define atomic_read(v) ((v)->counter) | 22 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
23 | #define atomic_set(v, i) (((v)->counter) = i) | 23 | #define atomic_set(v, i) (((v)->counter) = i) |
24 | 24 | ||
25 | /* | 25 | /* |
diff --git a/arch/cris/include/asm/atomic.h b/arch/cris/include/asm/atomic.h index a6aca819e9f3..88dc9b9c4ba0 100644 --- a/arch/cris/include/asm/atomic.h +++ b/arch/cris/include/asm/atomic.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #define ATOMIC_INIT(i) { (i) } | 16 | #define ATOMIC_INIT(i) { (i) } |
17 | 17 | ||
18 | #define atomic_read(v) ((v)->counter) | 18 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
19 | #define atomic_set(v,i) (((v)->counter) = (i)) | 19 | #define atomic_set(v,i) (((v)->counter) = (i)) |
20 | 20 | ||
21 | /* These should be written in asm but we do it in C for now. */ | 21 | /* These should be written in asm but we do it in C for now. */ |
diff --git a/arch/frv/include/asm/atomic.h b/arch/frv/include/asm/atomic.h index 00a57af79afc..fae32c7fdcb6 100644 --- a/arch/frv/include/asm/atomic.h +++ b/arch/frv/include/asm/atomic.h | |||
@@ -36,7 +36,7 @@ | |||
36 | #define smp_mb__after_atomic_inc() barrier() | 36 | #define smp_mb__after_atomic_inc() barrier() |
37 | 37 | ||
38 | #define ATOMIC_INIT(i) { (i) } | 38 | #define ATOMIC_INIT(i) { (i) } |
39 | #define atomic_read(v) ((v)->counter) | 39 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
40 | #define atomic_set(v, i) (((v)->counter) = (i)) | 40 | #define atomic_set(v, i) (((v)->counter) = (i)) |
41 | 41 | ||
42 | #ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS | 42 | #ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS |
diff --git a/arch/h8300/include/asm/atomic.h b/arch/h8300/include/asm/atomic.h index 33c8c0fa9583..e936804b7508 100644 --- a/arch/h8300/include/asm/atomic.h +++ b/arch/h8300/include/asm/atomic.h | |||
@@ -10,7 +10,7 @@ | |||
10 | 10 | ||
11 | #define ATOMIC_INIT(i) { (i) } | 11 | #define ATOMIC_INIT(i) { (i) } |
12 | 12 | ||
13 | #define atomic_read(v) ((v)->counter) | 13 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
14 | #define atomic_set(v, i) (((v)->counter) = i) | 14 | #define atomic_set(v, i) (((v)->counter) = i) |
15 | 15 | ||
16 | #include <asm/system.h> | 16 | #include <asm/system.h> |
diff --git a/arch/ia64/include/asm/atomic.h b/arch/ia64/include/asm/atomic.h index 88405cb0832a..4e1948447a00 100644 --- a/arch/ia64/include/asm/atomic.h +++ b/arch/ia64/include/asm/atomic.h | |||
@@ -21,8 +21,8 @@ | |||
21 | #define ATOMIC_INIT(i) ((atomic_t) { (i) }) | 21 | #define ATOMIC_INIT(i) ((atomic_t) { (i) }) |
22 | #define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) | 22 | #define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) |
23 | 23 | ||
24 | #define atomic_read(v) ((v)->counter) | 24 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
25 | #define atomic64_read(v) ((v)->counter) | 25 | #define atomic64_read(v) (*(volatile long *)&(v)->counter) |
26 | 26 | ||
27 | #define atomic_set(v,i) (((v)->counter) = (i)) | 27 | #define atomic_set(v,i) (((v)->counter) = (i)) |
28 | #define atomic64_set(v,i) (((v)->counter) = (i)) | 28 | #define atomic64_set(v,i) (((v)->counter) = (i)) |
diff --git a/arch/m32r/include/asm/atomic.h b/arch/m32r/include/asm/atomic.h index 63f0cf0f50dd..d44a51e5271b 100644 --- a/arch/m32r/include/asm/atomic.h +++ b/arch/m32r/include/asm/atomic.h | |||
@@ -26,7 +26,7 @@ | |||
26 | * | 26 | * |
27 | * Atomically reads the value of @v. | 27 | * Atomically reads the value of @v. |
28 | */ | 28 | */ |
29 | #define atomic_read(v) ((v)->counter) | 29 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * atomic_set - set atomic variable | 32 | * atomic_set - set atomic variable |
diff --git a/arch/m68k/include/asm/atomic_mm.h b/arch/m68k/include/asm/atomic_mm.h index d9d2ed647435..6a223b3f7e74 100644 --- a/arch/m68k/include/asm/atomic_mm.h +++ b/arch/m68k/include/asm/atomic_mm.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #define ATOMIC_INIT(i) { (i) } | 16 | #define ATOMIC_INIT(i) { (i) } |
17 | 17 | ||
18 | #define atomic_read(v) ((v)->counter) | 18 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
19 | #define atomic_set(v, i) (((v)->counter) = i) | 19 | #define atomic_set(v, i) (((v)->counter) = i) |
20 | 20 | ||
21 | static inline void atomic_add(int i, atomic_t *v) | 21 | static inline void atomic_add(int i, atomic_t *v) |
diff --git a/arch/m68k/include/asm/atomic_no.h b/arch/m68k/include/asm/atomic_no.h index 5674cb9449bd..289310c63a8a 100644 --- a/arch/m68k/include/asm/atomic_no.h +++ b/arch/m68k/include/asm/atomic_no.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #define ATOMIC_INIT(i) { (i) } | 16 | #define ATOMIC_INIT(i) { (i) } |
17 | 17 | ||
18 | #define atomic_read(v) ((v)->counter) | 18 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
19 | #define atomic_set(v, i) (((v)->counter) = i) | 19 | #define atomic_set(v, i) (((v)->counter) = i) |
20 | 20 | ||
21 | static __inline__ void atomic_add(int i, atomic_t *v) | 21 | static __inline__ void atomic_add(int i, atomic_t *v) |
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h index 519197ede089..59dc0c7ef733 100644 --- a/arch/mips/include/asm/atomic.h +++ b/arch/mips/include/asm/atomic.h | |||
@@ -29,7 +29,7 @@ | |||
29 | * | 29 | * |
30 | * Atomically reads the value of @v. | 30 | * Atomically reads the value of @v. |
31 | */ | 31 | */ |
32 | #define atomic_read(v) ((v)->counter) | 32 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
33 | 33 | ||
34 | /* | 34 | /* |
35 | * atomic_set - set atomic variable | 35 | * atomic_set - set atomic variable |
@@ -410,7 +410,7 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) | |||
410 | * @v: pointer of type atomic64_t | 410 | * @v: pointer of type atomic64_t |
411 | * | 411 | * |
412 | */ | 412 | */ |
413 | #define atomic64_read(v) ((v)->counter) | 413 | #define atomic64_read(v) (*(volatile long *)&(v)->counter) |
414 | 414 | ||
415 | /* | 415 | /* |
416 | * atomic64_set - set atomic variable | 416 | * atomic64_set - set atomic variable |
diff --git a/arch/mn10300/include/asm/atomic.h b/arch/mn10300/include/asm/atomic.h index 5bf5be9566de..e41222d6c2fd 100644 --- a/arch/mn10300/include/asm/atomic.h +++ b/arch/mn10300/include/asm/atomic.h | |||
@@ -31,7 +31,7 @@ | |||
31 | * Atomically reads the value of @v. Note that the guaranteed | 31 | * Atomically reads the value of @v. Note that the guaranteed |
32 | * useful range of an atomic_t is only 24 bits. | 32 | * useful range of an atomic_t is only 24 bits. |
33 | */ | 33 | */ |
34 | #define atomic_read(v) ((v)->counter) | 34 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * atomic_set - set atomic variable | 37 | * atomic_set - set atomic variable |
diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h index 716634d1f546..f81955934aeb 100644 --- a/arch/parisc/include/asm/atomic.h +++ b/arch/parisc/include/asm/atomic.h | |||
@@ -189,7 +189,7 @@ static __inline__ void atomic_set(atomic_t *v, int i) | |||
189 | 189 | ||
190 | static __inline__ int atomic_read(const atomic_t *v) | 190 | static __inline__ int atomic_read(const atomic_t *v) |
191 | { | 191 | { |
192 | return v->counter; | 192 | return (*(volatile int *)&(v)->counter); |
193 | } | 193 | } |
194 | 194 | ||
195 | /* exported interface */ | 195 | /* exported interface */ |
@@ -286,7 +286,7 @@ atomic64_set(atomic64_t *v, s64 i) | |||
286 | static __inline__ s64 | 286 | static __inline__ s64 |
287 | atomic64_read(const atomic64_t *v) | 287 | atomic64_read(const atomic64_t *v) |
288 | { | 288 | { |
289 | return v->counter; | 289 | return (*(volatile long *)&(v)->counter); |
290 | } | 290 | } |
291 | 291 | ||
292 | #define atomic64_add(i,v) ((void)(__atomic64_add_return( ((s64)(i)),(v)))) | 292 | #define atomic64_add(i,v) ((void)(__atomic64_add_return( ((s64)(i)),(v)))) |
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h index 275a448ae8c2..c7983124d99d 100644 --- a/arch/sh/include/asm/atomic.h +++ b/arch/sh/include/asm/atomic.h | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) | 14 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) |
15 | 15 | ||
16 | #define atomic_read(v) ((v)->counter) | 16 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
17 | #define atomic_set(v,i) ((v)->counter = (i)) | 17 | #define atomic_set(v,i) ((v)->counter = (i)) |
18 | 18 | ||
19 | #if defined(CONFIG_GUSA_RB) | 19 | #if defined(CONFIG_GUSA_RB) |
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h index f0d343c3b956..7ae128b19d3f 100644 --- a/arch/sparc/include/asm/atomic_32.h +++ b/arch/sparc/include/asm/atomic_32.h | |||
@@ -25,7 +25,7 @@ extern int atomic_cmpxchg(atomic_t *, int, int); | |||
25 | extern int atomic_add_unless(atomic_t *, int, int); | 25 | extern int atomic_add_unless(atomic_t *, int, int); |
26 | extern void atomic_set(atomic_t *, int); | 26 | extern void atomic_set(atomic_t *, int); |
27 | 27 | ||
28 | #define atomic_read(v) ((v)->counter) | 28 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
29 | 29 | ||
30 | #define atomic_add(i, v) ((void)__atomic_add_return( (int)(i), (v))) | 30 | #define atomic_add(i, v) ((void)__atomic_add_return( (int)(i), (v))) |
31 | #define atomic_sub(i, v) ((void)__atomic_add_return(-(int)(i), (v))) | 31 | #define atomic_sub(i, v) ((void)__atomic_add_return(-(int)(i), (v))) |
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h index f2e48009989e..2050ca02c423 100644 --- a/arch/sparc/include/asm/atomic_64.h +++ b/arch/sparc/include/asm/atomic_64.h | |||
@@ -13,8 +13,8 @@ | |||
13 | #define ATOMIC_INIT(i) { (i) } | 13 | #define ATOMIC_INIT(i) { (i) } |
14 | #define ATOMIC64_INIT(i) { (i) } | 14 | #define ATOMIC64_INIT(i) { (i) } |
15 | 15 | ||
16 | #define atomic_read(v) ((v)->counter) | 16 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
17 | #define atomic64_read(v) ((v)->counter) | 17 | #define atomic64_read(v) (*(volatile long *)&(v)->counter) |
18 | 18 | ||
19 | #define atomic_set(v, i) (((v)->counter) = i) | 19 | #define atomic_set(v, i) (((v)->counter) = i) |
20 | #define atomic64_set(v, i) (((v)->counter) = i) | 20 | #define atomic64_set(v, i) (((v)->counter) = i) |
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h index 8f8217b9bdac..37b39d27abe0 100644 --- a/arch/x86/include/asm/atomic.h +++ b/arch/x86/include/asm/atomic.h | |||
@@ -22,7 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | static inline int atomic_read(const atomic_t *v) | 23 | static inline int atomic_read(const atomic_t *v) |
24 | { | 24 | { |
25 | return v->counter; | 25 | return (*(volatile int *)&(v)->counter); |
26 | } | 26 | } |
27 | 27 | ||
28 | /** | 28 | /** |
diff --git a/arch/x86/include/asm/atomic64_64.h b/arch/x86/include/asm/atomic64_64.h index 51c5b4056929..b014e235ea8d 100644 --- a/arch/x86/include/asm/atomic64_64.h +++ b/arch/x86/include/asm/atomic64_64.h | |||
@@ -18,7 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | static inline long atomic64_read(const atomic64_t *v) | 19 | static inline long atomic64_read(const atomic64_t *v) |
20 | { | 20 | { |
21 | return v->counter; | 21 | return (*(volatile long *)&(v)->counter); |
22 | } | 22 | } |
23 | 23 | ||
24 | /** | 24 | /** |
diff --git a/arch/xtensa/include/asm/atomic.h b/arch/xtensa/include/asm/atomic.h index 22d6dde42619..a96a0619d0b7 100644 --- a/arch/xtensa/include/asm/atomic.h +++ b/arch/xtensa/include/asm/atomic.h | |||
@@ -46,7 +46,7 @@ | |||
46 | * | 46 | * |
47 | * Atomically reads the value of @v. | 47 | * Atomically reads the value of @v. |
48 | */ | 48 | */ |
49 | #define atomic_read(v) ((v)->counter) | 49 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * atomic_set - set atomic variable | 52 | * atomic_set - set atomic variable |