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 /include | |
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 'include')
-rw-r--r-- | include/asm-frv/atomic.h | 4 | ||||
-rw-r--r-- | include/asm-m32r/atomic.h | 8 | ||||
-rw-r--r-- | include/asm-m68k/atomic.h | 3 | ||||
-rw-r--r-- | include/asm-mn10300/atomic.h | 9 | ||||
-rw-r--r-- | include/asm-xtensa/atomic.h | 3 | ||||
-rw-r--r-- | include/linux/types.h | 10 |
6 files changed, 13 insertions, 24 deletions
diff --git a/include/asm-frv/atomic.h b/include/asm-frv/atomic.h index 46d696b331e7..296c35cfb207 100644 --- a/include/asm-frv/atomic.h +++ b/include/asm-frv/atomic.h | |||
@@ -35,10 +35,6 @@ | |||
35 | #define smp_mb__before_atomic_inc() barrier() | 35 | #define smp_mb__before_atomic_inc() barrier() |
36 | #define smp_mb__after_atomic_inc() barrier() | 36 | #define smp_mb__after_atomic_inc() barrier() |
37 | 37 | ||
38 | typedef struct { | ||
39 | int counter; | ||
40 | } atomic_t; | ||
41 | |||
42 | #define ATOMIC_INIT(i) { (i) } | 38 | #define ATOMIC_INIT(i) { (i) } |
43 | #define atomic_read(v) ((v)->counter) | 39 | #define atomic_read(v) ((v)->counter) |
44 | #define atomic_set(v, i) (((v)->counter) = (i)) | 40 | #define atomic_set(v, i) (((v)->counter) = (i)) |
diff --git a/include/asm-m32r/atomic.h b/include/asm-m32r/atomic.h index 3a38ffe4a4f4..2eed30f84080 100644 --- a/include/asm-m32r/atomic.h +++ b/include/asm-m32r/atomic.h | |||
@@ -9,6 +9,7 @@ | |||
9 | * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org> | 9 | * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org> |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/types.h> | ||
12 | #include <asm/assembler.h> | 13 | #include <asm/assembler.h> |
13 | #include <asm/system.h> | 14 | #include <asm/system.h> |
14 | 15 | ||
@@ -17,13 +18,6 @@ | |||
17 | * resource counting etc.. | 18 | * resource counting etc.. |
18 | */ | 19 | */ |
19 | 20 | ||
20 | /* | ||
21 | * Make sure gcc doesn't try to be clever and move things around | ||
22 | * on us. We need to use _exactly_ the address the user gave us, | ||
23 | * not some alias that contains the same information. | ||
24 | */ | ||
25 | typedef struct { volatile int counter; } atomic_t; | ||
26 | |||
27 | #define ATOMIC_INIT(i) { (i) } | 21 | #define ATOMIC_INIT(i) { (i) } |
28 | 22 | ||
29 | /** | 23 | /** |
diff --git a/include/asm-m68k/atomic.h b/include/asm-m68k/atomic.h index 4915294fea63..eb0ab9d4ee77 100644 --- a/include/asm-m68k/atomic.h +++ b/include/asm-m68k/atomic.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef __ARCH_M68K_ATOMIC__ | 1 | #ifndef __ARCH_M68K_ATOMIC__ |
2 | #define __ARCH_M68K_ATOMIC__ | 2 | #define __ARCH_M68K_ATOMIC__ |
3 | 3 | ||
4 | 4 | #include <linux/types.h> | |
5 | #include <asm/system.h> | 5 | #include <asm/system.h> |
6 | 6 | ||
7 | /* | 7 | /* |
@@ -13,7 +13,6 @@ | |||
13 | * 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. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | typedef struct { int counter; } atomic_t; | ||
17 | #define ATOMIC_INIT(i) { (i) } | 16 | #define ATOMIC_INIT(i) { (i) } |
18 | 17 | ||
19 | #define atomic_read(v) ((v)->counter) | 18 | #define atomic_read(v) ((v)->counter) |
diff --git a/include/asm-mn10300/atomic.h b/include/asm-mn10300/atomic.h index 27c9690b9574..bc064825f9b1 100644 --- a/include/asm-mn10300/atomic.h +++ b/include/asm-mn10300/atomic.h | |||
@@ -20,15 +20,6 @@ | |||
20 | * resource counting etc.. | 20 | * resource counting etc.. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | /* | ||
24 | * Make sure gcc doesn't try to be clever and move things around | ||
25 | * on us. We need to use _exactly_ the address the user gave us, | ||
26 | * not some alias that contains the same information. | ||
27 | */ | ||
28 | typedef struct { | ||
29 | int counter; | ||
30 | } atomic_t; | ||
31 | |||
32 | #define ATOMIC_INIT(i) { (i) } | 23 | #define ATOMIC_INIT(i) { (i) } |
33 | 24 | ||
34 | #ifdef __KERNEL__ | 25 | #ifdef __KERNEL__ |
diff --git a/include/asm-xtensa/atomic.h b/include/asm-xtensa/atomic.h index b3b23540f14d..67ad67bed8c1 100644 --- a/include/asm-xtensa/atomic.h +++ b/include/asm-xtensa/atomic.h | |||
@@ -14,8 +14,7 @@ | |||
14 | #define _XTENSA_ATOMIC_H | 14 | #define _XTENSA_ATOMIC_H |
15 | 15 | ||
16 | #include <linux/stringify.h> | 16 | #include <linux/stringify.h> |
17 | 17 | #include <linux/types.h> | |
18 | typedef struct { volatile int counter; } atomic_t; | ||
19 | 18 | ||
20 | #ifdef __KERNEL__ | 19 | #ifdef __KERNEL__ |
21 | #include <asm/processor.h> | 20 | #include <asm/processor.h> |
diff --git a/include/linux/types.h b/include/linux/types.h index 121f349cb7ec..3b864f2d9560 100644 --- a/include/linux/types.h +++ b/include/linux/types.h | |||
@@ -195,6 +195,16 @@ typedef u32 phys_addr_t; | |||
195 | 195 | ||
196 | typedef phys_addr_t resource_size_t; | 196 | typedef phys_addr_t resource_size_t; |
197 | 197 | ||
198 | typedef struct { | ||
199 | volatile int counter; | ||
200 | } atomic_t; | ||
201 | |||
202 | #ifdef CONFIG_64BIT | ||
203 | typedef struct { | ||
204 | volatile long counter; | ||
205 | } atomic64_t; | ||
206 | #endif | ||
207 | |||
198 | struct ustat { | 208 | struct ustat { |
199 | __kernel_daddr_t f_tfree; | 209 | __kernel_daddr_t f_tfree; |
200 | __kernel_ino_t f_tinode; | 210 | __kernel_ino_t f_tinode; |