diff options
author | Matthew Wilcox <matthew@wil.cx> | 2009-01-06 17:40:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-06 18:59:10 -0500 |
commit | ea435467500612636f8f4fb639ff6e76b2496e4b (patch) | |
tree | fdf5cb7ca3834f0a4120fb3cce5a631dd2769f26 /arch | |
parent | f99ebf0a86de13f77bc4ee349de96db9f2f67f2e (diff) |
atomic_t: unify all arch definitions
The atomic_t type cannot currently be used in some header files because it
would create an include loop with asm/atomic.h. Move the type definition
to linux/types.h to break the loop.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/include/asm/atomic.h | 9 | ||||
-rw-r--r-- | arch/arm/include/asm/atomic.h | 3 | ||||
-rw-r--r-- | arch/avr32/include/asm/atomic.h | 2 | ||||
-rw-r--r-- | arch/blackfin/include/asm/atomic.h | 4 | ||||
-rw-r--r-- | arch/cris/include/asm/atomic.h | 4 | ||||
-rw-r--r-- | arch/h8300/include/asm/atomic.h | 3 | ||||
-rw-r--r-- | arch/ia64/include/asm/atomic.h | 6 | ||||
-rw-r--r-- | arch/m68knommu/include/asm/atomic.h | 2 | ||||
-rw-r--r-- | arch/mips/include/asm/atomic.h | 5 | ||||
-rw-r--r-- | arch/parisc/include/asm/atomic.h | 11 | ||||
-rw-r--r-- | arch/powerpc/include/asm/atomic.h | 4 | ||||
-rw-r--r-- | arch/s390/include/asm/atomic.h | 7 | ||||
-rw-r--r-- | arch/sh/include/asm/atomic.h | 7 | ||||
-rw-r--r-- | arch/sparc/include/asm/atomic_32.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/atomic_64.h | 3 | ||||
-rw-r--r-- | arch/x86/include/asm/atomic_32.h | 10 | ||||
-rw-r--r-- | arch/x86/include/asm/atomic_64.h | 18 |
17 files changed, 20 insertions, 80 deletions
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h index ca88e54dec93..62b363584b2b 100644 --- a/arch/alpha/include/asm/atomic.h +++ b/arch/alpha/include/asm/atomic.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _ALPHA_ATOMIC_H | 1 | #ifndef _ALPHA_ATOMIC_H |
2 | #define _ALPHA_ATOMIC_H | 2 | #define _ALPHA_ATOMIC_H |
3 | 3 | ||
4 | #include <linux/types.h> | ||
4 | #include <asm/barrier.h> | 5 | #include <asm/barrier.h> |
5 | #include <asm/system.h> | 6 | #include <asm/system.h> |
6 | 7 | ||
@@ -13,14 +14,6 @@ | |||
13 | */ | 14 | */ |
14 | 15 | ||
15 | 16 | ||
16 | /* | ||
17 | * Counter is volatile to make sure gcc doesn't try to be clever | ||
18 | * and move things around on us. We need to use _exactly_ the address | ||
19 | * the user gave us, not some alias that contains the same information. | ||
20 | */ | ||
21 | typedef struct { volatile int counter; } atomic_t; | ||
22 | typedef struct { volatile long counter; } atomic64_t; | ||
23 | |||
24 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) | 17 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) |
25 | #define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } ) | 18 | #define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } ) |
26 | 19 | ||
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h index 325f881ccb50..ee99723b3a6c 100644 --- a/arch/arm/include/asm/atomic.h +++ b/arch/arm/include/asm/atomic.h | |||
@@ -12,10 +12,9 @@ | |||
12 | #define __ASM_ARM_ATOMIC_H | 12 | #define __ASM_ARM_ATOMIC_H |
13 | 13 | ||
14 | #include <linux/compiler.h> | 14 | #include <linux/compiler.h> |
15 | #include <linux/types.h> | ||
15 | #include <asm/system.h> | 16 | #include <asm/system.h> |
16 | 17 | ||
17 | typedef struct { volatile int counter; } atomic_t; | ||
18 | |||
19 | #define ATOMIC_INIT(i) { (i) } | 18 | #define ATOMIC_INIT(i) { (i) } |
20 | 19 | ||
21 | #ifdef __KERNEL__ | 20 | #ifdef __KERNEL__ |
diff --git a/arch/avr32/include/asm/atomic.h b/arch/avr32/include/asm/atomic.h index 7ef3862a73d0..318815107748 100644 --- a/arch/avr32/include/asm/atomic.h +++ b/arch/avr32/include/asm/atomic.h | |||
@@ -14,9 +14,9 @@ | |||
14 | #ifndef __ASM_AVR32_ATOMIC_H | 14 | #ifndef __ASM_AVR32_ATOMIC_H |
15 | #define __ASM_AVR32_ATOMIC_H | 15 | #define __ASM_AVR32_ATOMIC_H |
16 | 16 | ||
17 | #include <linux/types.h> | ||
17 | #include <asm/system.h> | 18 | #include <asm/system.h> |
18 | 19 | ||
19 | typedef struct { volatile int counter; } atomic_t; | ||
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) ((v)->counter) |
diff --git a/arch/blackfin/include/asm/atomic.h b/arch/blackfin/include/asm/atomic.h index 7cf508718605..25776c19064b 100644 --- a/arch/blackfin/include/asm/atomic.h +++ b/arch/blackfin/include/asm/atomic.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __ARCH_BLACKFIN_ATOMIC__ | 1 | #ifndef __ARCH_BLACKFIN_ATOMIC__ |
2 | #define __ARCH_BLACKFIN_ATOMIC__ | 2 | #define __ARCH_BLACKFIN_ATOMIC__ |
3 | 3 | ||
4 | #include <linux/types.h> | ||
4 | #include <asm/system.h> /* local_irq_XXX() */ | 5 | #include <asm/system.h> /* local_irq_XXX() */ |
5 | 6 | ||
6 | /* | 7 | /* |
@@ -13,9 +14,6 @@ | |||
13 | * Tony Kou (tonyko@lineo.ca) Lineo Inc. 2001 | 14 | * Tony Kou (tonyko@lineo.ca) Lineo Inc. 2001 |
14 | */ | 15 | */ |
15 | 16 | ||
16 | typedef struct { | ||
17 | int counter; | ||
18 | } atomic_t; | ||
19 | #define ATOMIC_INIT(i) { (i) } | 17 | #define ATOMIC_INIT(i) { (i) } |
20 | 18 | ||
21 | #define atomic_read(v) ((v)->counter) | 19 | #define atomic_read(v) ((v)->counter) |
diff --git a/arch/cris/include/asm/atomic.h b/arch/cris/include/asm/atomic.h index f71ea686a2ea..5718dd8902a1 100644 --- a/arch/cris/include/asm/atomic.h +++ b/arch/cris/include/asm/atomic.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #define __ASM_CRIS_ATOMIC__ | 4 | #define __ASM_CRIS_ATOMIC__ |
5 | 5 | ||
6 | #include <linux/compiler.h> | 6 | #include <linux/compiler.h> |
7 | 7 | #include <linux/types.h> | |
8 | #include <asm/system.h> | 8 | #include <asm/system.h> |
9 | #include <arch/atomic.h> | 9 | #include <arch/atomic.h> |
10 | 10 | ||
@@ -13,8 +13,6 @@ | |||
13 | * resource counting etc.. | 13 | * resource counting etc.. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | typedef struct { volatile int counter; } atomic_t; | ||
17 | |||
18 | #define ATOMIC_INIT(i) { (i) } | 16 | #define ATOMIC_INIT(i) { (i) } |
19 | 17 | ||
20 | #define atomic_read(v) ((v)->counter) | 18 | #define atomic_read(v) ((v)->counter) |
diff --git a/arch/h8300/include/asm/atomic.h b/arch/h8300/include/asm/atomic.h index b4cf0ea97ede..833186c8dc3b 100644 --- a/arch/h8300/include/asm/atomic.h +++ b/arch/h8300/include/asm/atomic.h | |||
@@ -1,12 +1,13 @@ | |||
1 | #ifndef __ARCH_H8300_ATOMIC__ | 1 | #ifndef __ARCH_H8300_ATOMIC__ |
2 | #define __ARCH_H8300_ATOMIC__ | 2 | #define __ARCH_H8300_ATOMIC__ |
3 | 3 | ||
4 | #include <linux/types.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * Atomic operations that C can't guarantee us. Useful for | 7 | * Atomic operations that C can't guarantee us. Useful for |
6 | * resource counting etc.. | 8 | * resource counting etc.. |
7 | */ | 9 | */ |
8 | 10 | ||
9 | typedef struct { int counter; } atomic_t; | ||
10 | #define ATOMIC_INIT(i) { (i) } | 11 | #define ATOMIC_INIT(i) { (i) } |
11 | 12 | ||
12 | #define atomic_read(v) ((v)->counter) | 13 | #define atomic_read(v) ((v)->counter) |
diff --git a/arch/ia64/include/asm/atomic.h b/arch/ia64/include/asm/atomic.h index 50c2b83fd5a0..d37292bd9875 100644 --- a/arch/ia64/include/asm/atomic.h +++ b/arch/ia64/include/asm/atomic.h | |||
@@ -17,12 +17,6 @@ | |||
17 | #include <asm/intrinsics.h> | 17 | #include <asm/intrinsics.h> |
18 | #include <asm/system.h> | 18 | #include <asm/system.h> |
19 | 19 | ||
20 | /* | ||
21 | * On IA-64, counter must always be volatile to ensure that that the | ||
22 | * memory accesses are ordered. | ||
23 | */ | ||
24 | typedef struct { volatile __s32 counter; } atomic_t; | ||
25 | typedef struct { volatile __s64 counter; } atomic64_t; | ||
26 | 20 | ||
27 | #define ATOMIC_INIT(i) ((atomic_t) { (i) }) | 21 | #define ATOMIC_INIT(i) ((atomic_t) { (i) }) |
28 | #define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) | 22 | #define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) |
diff --git a/arch/m68knommu/include/asm/atomic.h b/arch/m68knommu/include/asm/atomic.h index d5632a305dae..6bb674855a3f 100644 --- a/arch/m68knommu/include/asm/atomic.h +++ b/arch/m68knommu/include/asm/atomic.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __ARCH_M68KNOMMU_ATOMIC__ | 1 | #ifndef __ARCH_M68KNOMMU_ATOMIC__ |
2 | #define __ARCH_M68KNOMMU_ATOMIC__ | 2 | #define __ARCH_M68KNOMMU_ATOMIC__ |
3 | 3 | ||
4 | #include <linux/types.h> | ||
4 | #include <asm/system.h> | 5 | #include <asm/system.h> |
5 | 6 | ||
6 | /* | 7 | /* |
@@ -12,7 +13,6 @@ | |||
12 | * We do not have SMP m68k systems, so we don't have to deal with that. | 13 | * We do not have SMP m68k systems, so we don't have to deal with that. |
13 | */ | 14 | */ |
14 | 15 | ||
15 | typedef struct { int counter; } atomic_t; | ||
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) ((v)->counter) |
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h index 1232be3885b0..c996c3b4d074 100644 --- a/arch/mips/include/asm/atomic.h +++ b/arch/mips/include/asm/atomic.h | |||
@@ -15,13 +15,12 @@ | |||
15 | #define _ASM_ATOMIC_H | 15 | #define _ASM_ATOMIC_H |
16 | 16 | ||
17 | #include <linux/irqflags.h> | 17 | #include <linux/irqflags.h> |
18 | #include <linux/types.h> | ||
18 | #include <asm/barrier.h> | 19 | #include <asm/barrier.h> |
19 | #include <asm/cpu-features.h> | 20 | #include <asm/cpu-features.h> |
20 | #include <asm/war.h> | 21 | #include <asm/war.h> |
21 | #include <asm/system.h> | 22 | #include <asm/system.h> |
22 | 23 | ||
23 | typedef struct { volatile int counter; } atomic_t; | ||
24 | |||
25 | #define ATOMIC_INIT(i) { (i) } | 24 | #define ATOMIC_INIT(i) { (i) } |
26 | 25 | ||
27 | /* | 26 | /* |
@@ -404,8 +403,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) | |||
404 | 403 | ||
405 | #ifdef CONFIG_64BIT | 404 | #ifdef CONFIG_64BIT |
406 | 405 | ||
407 | typedef struct { volatile long counter; } atomic64_t; | ||
408 | |||
409 | #define ATOMIC64_INIT(i) { (i) } | 406 | #define ATOMIC64_INIT(i) { (i) } |
410 | 407 | ||
411 | /* | 408 | /* |
diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h index 57fcc4a5ebb4..edbfe25c5fc1 100644 --- a/arch/parisc/include/asm/atomic.h +++ b/arch/parisc/include/asm/atomic.h | |||
@@ -155,14 +155,11 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr, | |||
155 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | 155 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) |
156 | #endif | 156 | #endif |
157 | 157 | ||
158 | /* Note that we need not lock read accesses - aligned word writes/reads | 158 | /* |
159 | * are atomic, so a reader never sees unconsistent values. | 159 | * Note that we need not lock read accesses - aligned word writes/reads |
160 | * | 160 | * are atomic, so a reader never sees inconsistent values. |
161 | * Cache-line alignment would conflict with, for example, linux/module.h | ||
162 | */ | 161 | */ |
163 | 162 | ||
164 | typedef struct { volatile int counter; } atomic_t; | ||
165 | |||
166 | /* It's possible to reduce all atomic operations to either | 163 | /* It's possible to reduce all atomic operations to either |
167 | * __atomic_add_return, atomic_set and atomic_read (the latter | 164 | * __atomic_add_return, atomic_set and atomic_read (the latter |
168 | * is there only for consistency). | 165 | * is there only for consistency). |
@@ -260,8 +257,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) | |||
260 | 257 | ||
261 | #ifdef CONFIG_64BIT | 258 | #ifdef CONFIG_64BIT |
262 | 259 | ||
263 | typedef struct { volatile s64 counter; } atomic64_t; | ||
264 | |||
265 | #define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) | 260 | #define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) |
266 | 261 | ||
267 | static __inline__ int | 262 | static __inline__ int |
diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h index 499be5bdd6fa..b401950f5259 100644 --- a/arch/powerpc/include/asm/atomic.h +++ b/arch/powerpc/include/asm/atomic.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * PowerPC atomic operations | 5 | * PowerPC atomic operations |
6 | */ | 6 | */ |
7 | 7 | ||
8 | typedef struct { int counter; } atomic_t; | 8 | #include <linux/types.h> |
9 | 9 | ||
10 | #ifdef __KERNEL__ | 10 | #ifdef __KERNEL__ |
11 | #include <linux/compiler.h> | 11 | #include <linux/compiler.h> |
@@ -251,8 +251,6 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v) | |||
251 | 251 | ||
252 | #ifdef __powerpc64__ | 252 | #ifdef __powerpc64__ |
253 | 253 | ||
254 | typedef struct { long counter; } atomic64_t; | ||
255 | |||
256 | #define ATOMIC64_INIT(i) { (i) } | 254 | #define ATOMIC64_INIT(i) { (i) } |
257 | 255 | ||
258 | static __inline__ long atomic64_read(const atomic64_t *v) | 256 | static __inline__ long atomic64_read(const atomic64_t *v) |
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h index 2d184655bc5d..de432f2de2d2 100644 --- a/arch/s390/include/asm/atomic.h +++ b/arch/s390/include/asm/atomic.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __ARCH_S390_ATOMIC__ | 2 | #define __ARCH_S390_ATOMIC__ |
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <linux/types.h> | ||
5 | 6 | ||
6 | /* | 7 | /* |
7 | * include/asm-s390/atomic.h | 8 | * include/asm-s390/atomic.h |
@@ -23,9 +24,6 @@ | |||
23 | * S390 uses 'Compare And Swap' for atomicity in SMP enviroment | 24 | * S390 uses 'Compare And Swap' for atomicity in SMP enviroment |
24 | */ | 25 | */ |
25 | 26 | ||
26 | typedef struct { | ||
27 | int counter; | ||
28 | } __attribute__ ((aligned (4))) atomic_t; | ||
29 | #define ATOMIC_INIT(i) { (i) } | 27 | #define ATOMIC_INIT(i) { (i) } |
30 | 28 | ||
31 | #ifdef __KERNEL__ | 29 | #ifdef __KERNEL__ |
@@ -149,9 +147,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) | |||
149 | #undef __CS_LOOP | 147 | #undef __CS_LOOP |
150 | 148 | ||
151 | #ifdef __s390x__ | 149 | #ifdef __s390x__ |
152 | typedef struct { | ||
153 | long long counter; | ||
154 | } __attribute__ ((aligned (8))) atomic64_t; | ||
155 | #define ATOMIC64_INIT(i) { (i) } | 150 | #define ATOMIC64_INIT(i) { (i) } |
156 | 151 | ||
157 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) | 152 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) |
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h index c043ef003028..6327ffbb1992 100644 --- a/arch/sh/include/asm/atomic.h +++ b/arch/sh/include/asm/atomic.h | |||
@@ -7,16 +7,15 @@ | |||
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | 9 | ||
10 | typedef struct { volatile int counter; } atomic_t; | 10 | #include <linux/compiler.h> |
11 | #include <linux/types.h> | ||
12 | #include <asm/system.h> | ||
11 | 13 | ||
12 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) | 14 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) |
13 | 15 | ||
14 | #define atomic_read(v) ((v)->counter) | 16 | #define atomic_read(v) ((v)->counter) |
15 | #define atomic_set(v,i) ((v)->counter = (i)) | 17 | #define atomic_set(v,i) ((v)->counter = (i)) |
16 | 18 | ||
17 | #include <linux/compiler.h> | ||
18 | #include <asm/system.h> | ||
19 | |||
20 | #if defined(CONFIG_GUSA_RB) | 19 | #if defined(CONFIG_GUSA_RB) |
21 | #include <asm/atomic-grb.h> | 20 | #include <asm/atomic-grb.h> |
22 | #elif defined(CONFIG_CPU_SH4A) | 21 | #elif defined(CONFIG_CPU_SH4A) |
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h index 5c944b5a8040..ce465975a6a5 100644 --- a/arch/sparc/include/asm/atomic_32.h +++ b/arch/sparc/include/asm/atomic_32.h | |||
@@ -13,8 +13,6 @@ | |||
13 | 13 | ||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | 15 | ||
16 | typedef struct { volatile int counter; } atomic_t; | ||
17 | |||
18 | #ifdef __KERNEL__ | 16 | #ifdef __KERNEL__ |
19 | 17 | ||
20 | #define ATOMIC_INIT(i) { (i) } | 18 | #define ATOMIC_INIT(i) { (i) } |
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h index 5982c5ae7f07..a0a706492696 100644 --- a/arch/sparc/include/asm/atomic_64.h +++ b/arch/sparc/include/asm/atomic_64.h | |||
@@ -10,9 +10,6 @@ | |||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <asm/system.h> | 11 | #include <asm/system.h> |
12 | 12 | ||
13 | typedef struct { volatile int counter; } atomic_t; | ||
14 | typedef struct { volatile __s64 counter; } atomic64_t; | ||
15 | |||
16 | #define ATOMIC_INIT(i) { (i) } | 13 | #define ATOMIC_INIT(i) { (i) } |
17 | #define ATOMIC64_INIT(i) { (i) } | 14 | #define ATOMIC64_INIT(i) { (i) } |
18 | 15 | ||
diff --git a/arch/x86/include/asm/atomic_32.h b/arch/x86/include/asm/atomic_32.h index ad5b9f6ecddf..85b46fba4229 100644 --- a/arch/x86/include/asm/atomic_32.h +++ b/arch/x86/include/asm/atomic_32.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _ASM_X86_ATOMIC_32_H | 2 | #define _ASM_X86_ATOMIC_32_H |
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <linux/types.h> | ||
5 | #include <asm/processor.h> | 6 | #include <asm/processor.h> |
6 | #include <asm/cmpxchg.h> | 7 | #include <asm/cmpxchg.h> |
7 | 8 | ||
@@ -10,15 +11,6 @@ | |||
10 | * resource counting etc.. | 11 | * resource counting etc.. |
11 | */ | 12 | */ |
12 | 13 | ||
13 | /* | ||
14 | * Make sure gcc doesn't try to be clever and move things around | ||
15 | * on us. We need to use _exactly_ the address the user gave us, | ||
16 | * not some alias that contains the same information. | ||
17 | */ | ||
18 | typedef struct { | ||
19 | int counter; | ||
20 | } atomic_t; | ||
21 | |||
22 | #define ATOMIC_INIT(i) { (i) } | 14 | #define ATOMIC_INIT(i) { (i) } |
23 | 15 | ||
24 | /** | 16 | /** |
diff --git a/arch/x86/include/asm/atomic_64.h b/arch/x86/include/asm/atomic_64.h index 279d2a731f3f..8c21731984da 100644 --- a/arch/x86/include/asm/atomic_64.h +++ b/arch/x86/include/asm/atomic_64.h | |||
@@ -1,25 +1,15 @@ | |||
1 | #ifndef _ASM_X86_ATOMIC_64_H | 1 | #ifndef _ASM_X86_ATOMIC_64_H |
2 | #define _ASM_X86_ATOMIC_64_H | 2 | #define _ASM_X86_ATOMIC_64_H |
3 | 3 | ||
4 | #include <linux/types.h> | ||
4 | #include <asm/alternative.h> | 5 | #include <asm/alternative.h> |
5 | #include <asm/cmpxchg.h> | 6 | #include <asm/cmpxchg.h> |
6 | 7 | ||
7 | /* atomic_t should be 32 bit signed type */ | ||
8 | |||
9 | /* | 8 | /* |
10 | * Atomic operations that C can't guarantee us. Useful for | 9 | * Atomic operations that C can't guarantee us. Useful for |
11 | * resource counting etc.. | 10 | * resource counting etc.. |
12 | */ | 11 | */ |
13 | 12 | ||
14 | /* | ||
15 | * Make sure gcc doesn't try to be clever and move things around | ||
16 | * on us. We need to use _exactly_ the address the user gave us, | ||
17 | * not some alias that contains the same information. | ||
18 | */ | ||
19 | typedef struct { | ||
20 | int counter; | ||
21 | } atomic_t; | ||
22 | |||
23 | #define ATOMIC_INIT(i) { (i) } | 13 | #define ATOMIC_INIT(i) { (i) } |
24 | 14 | ||
25 | /** | 15 | /** |
@@ -191,11 +181,7 @@ static inline int atomic_sub_return(int i, atomic_t *v) | |||
191 | #define atomic_inc_return(v) (atomic_add_return(1, v)) | 181 | #define atomic_inc_return(v) (atomic_add_return(1, v)) |
192 | #define atomic_dec_return(v) (atomic_sub_return(1, v)) | 182 | #define atomic_dec_return(v) (atomic_sub_return(1, v)) |
193 | 183 | ||
194 | /* An 64bit atomic type */ | 184 | /* The 64-bit atomic type */ |
195 | |||
196 | typedef struct { | ||
197 | long counter; | ||
198 | } atomic64_t; | ||
199 | 185 | ||
200 | #define ATOMIC64_INIT(i) { (i) } | 186 | #define ATOMIC64_INIT(i) { (i) } |
201 | 187 | ||