diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-04-02 16:04:13 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-04-13 13:15:16 -0400 |
commit | 5ba840f9da1ff96e0c6e982608a9e80e35333cc5 (patch) | |
tree | 96ebea9798d3a15630c3ba73b730beb4d99689ab /arch | |
parent | 0034102808e0dbbf3a2394b82b1bb40b5778de9e (diff) |
alpha: fix build failures from system.h dismemberment
commit ec2212088c42ff7d1362629ec26dda4f3e8bdad3
"Disintegrate asm/system.h for Alpha"
combined with commit b4816afa3986704d1404fc48e931da5135820472
"Move the asm-generic/system.h xchg() implementation to asm-generic/cmpxchg.h"
introduced the concept of asm/cmpxchg.h but the alpha arch
never got one. Fork the cmpxchg content out of the asm/atomic.h
file to create one.
Some minor whitespace fixups were done on the block of code that
created the new file.
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: David Howells <dhowells@redhat.com>
Acked-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/include/asm/atomic.h | 68 | ||||
-rw-r--r-- | arch/alpha/include/asm/cmpxchg.h | 71 | ||||
-rw-r--r-- | arch/alpha/include/asm/xchg.h | 4 |
3 files changed, 74 insertions, 69 deletions
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h index f62251e82ffa..3bb7ffeae3bc 100644 --- a/arch/alpha/include/asm/atomic.h +++ b/arch/alpha/include/asm/atomic.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <asm/barrier.h> | 5 | #include <asm/barrier.h> |
6 | #include <asm/cmpxchg.h> | ||
6 | 7 | ||
7 | /* | 8 | /* |
8 | * Atomic operations that C can't guarantee us. Useful for | 9 | * Atomic operations that C can't guarantee us. Useful for |
@@ -168,73 +169,6 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v) | |||
168 | return result; | 169 | return result; |
169 | } | 170 | } |
170 | 171 | ||
171 | /* | ||
172 | * Atomic exchange routines. | ||
173 | */ | ||
174 | |||
175 | #define __ASM__MB | ||
176 | #define ____xchg(type, args...) __xchg ## type ## _local(args) | ||
177 | #define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args) | ||
178 | #include <asm/xchg.h> | ||
179 | |||
180 | #define xchg_local(ptr,x) \ | ||
181 | ({ \ | ||
182 | __typeof__(*(ptr)) _x_ = (x); \ | ||
183 | (__typeof__(*(ptr))) __xchg_local((ptr), (unsigned long)_x_, \ | ||
184 | sizeof(*(ptr))); \ | ||
185 | }) | ||
186 | |||
187 | #define cmpxchg_local(ptr, o, n) \ | ||
188 | ({ \ | ||
189 | __typeof__(*(ptr)) _o_ = (o); \ | ||
190 | __typeof__(*(ptr)) _n_ = (n); \ | ||
191 | (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \ | ||
192 | (unsigned long)_n_, \ | ||
193 | sizeof(*(ptr))); \ | ||
194 | }) | ||
195 | |||
196 | #define cmpxchg64_local(ptr, o, n) \ | ||
197 | ({ \ | ||
198 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
199 | cmpxchg_local((ptr), (o), (n)); \ | ||
200 | }) | ||
201 | |||
202 | #ifdef CONFIG_SMP | ||
203 | #undef __ASM__MB | ||
204 | #define __ASM__MB "\tmb\n" | ||
205 | #endif | ||
206 | #undef ____xchg | ||
207 | #undef ____cmpxchg | ||
208 | #define ____xchg(type, args...) __xchg ##type(args) | ||
209 | #define ____cmpxchg(type, args...) __cmpxchg ##type(args) | ||
210 | #include <asm/xchg.h> | ||
211 | |||
212 | #define xchg(ptr,x) \ | ||
213 | ({ \ | ||
214 | __typeof__(*(ptr)) _x_ = (x); \ | ||
215 | (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, \ | ||
216 | sizeof(*(ptr))); \ | ||
217 | }) | ||
218 | |||
219 | #define cmpxchg(ptr, o, n) \ | ||
220 | ({ \ | ||
221 | __typeof__(*(ptr)) _o_ = (o); \ | ||
222 | __typeof__(*(ptr)) _n_ = (n); \ | ||
223 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
224 | (unsigned long)_n_, sizeof(*(ptr)));\ | ||
225 | }) | ||
226 | |||
227 | #define cmpxchg64(ptr, o, n) \ | ||
228 | ({ \ | ||
229 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
230 | cmpxchg((ptr), (o), (n)); \ | ||
231 | }) | ||
232 | |||
233 | #undef __ASM__MB | ||
234 | #undef ____cmpxchg | ||
235 | |||
236 | #define __HAVE_ARCH_CMPXCHG 1 | ||
237 | |||
238 | #define atomic64_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new)) | 172 | #define atomic64_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new)) |
239 | #define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) | 173 | #define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) |
240 | 174 | ||
diff --git a/arch/alpha/include/asm/cmpxchg.h b/arch/alpha/include/asm/cmpxchg.h new file mode 100644 index 000000000000..429e8cd0d78e --- /dev/null +++ b/arch/alpha/include/asm/cmpxchg.h | |||
@@ -0,0 +1,71 @@ | |||
1 | #ifndef _ALPHA_CMPXCHG_H | ||
2 | #define _ALPHA_CMPXCHG_H | ||
3 | |||
4 | /* | ||
5 | * Atomic exchange routines. | ||
6 | */ | ||
7 | |||
8 | #define __ASM__MB | ||
9 | #define ____xchg(type, args...) __xchg ## type ## _local(args) | ||
10 | #define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args) | ||
11 | #include <asm/xchg.h> | ||
12 | |||
13 | #define xchg_local(ptr, x) \ | ||
14 | ({ \ | ||
15 | __typeof__(*(ptr)) _x_ = (x); \ | ||
16 | (__typeof__(*(ptr))) __xchg_local((ptr), (unsigned long)_x_, \ | ||
17 | sizeof(*(ptr))); \ | ||
18 | }) | ||
19 | |||
20 | #define cmpxchg_local(ptr, o, n) \ | ||
21 | ({ \ | ||
22 | __typeof__(*(ptr)) _o_ = (o); \ | ||
23 | __typeof__(*(ptr)) _n_ = (n); \ | ||
24 | (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \ | ||
25 | (unsigned long)_n_, \ | ||
26 | sizeof(*(ptr))); \ | ||
27 | }) | ||
28 | |||
29 | #define cmpxchg64_local(ptr, o, n) \ | ||
30 | ({ \ | ||
31 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
32 | cmpxchg_local((ptr), (o), (n)); \ | ||
33 | }) | ||
34 | |||
35 | #ifdef CONFIG_SMP | ||
36 | #undef __ASM__MB | ||
37 | #define __ASM__MB "\tmb\n" | ||
38 | #endif | ||
39 | #undef ____xchg | ||
40 | #undef ____cmpxchg | ||
41 | #define ____xchg(type, args...) __xchg ##type(args) | ||
42 | #define ____cmpxchg(type, args...) __cmpxchg ##type(args) | ||
43 | #include <asm/xchg.h> | ||
44 | |||
45 | #define xchg(ptr, x) \ | ||
46 | ({ \ | ||
47 | __typeof__(*(ptr)) _x_ = (x); \ | ||
48 | (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, \ | ||
49 | sizeof(*(ptr))); \ | ||
50 | }) | ||
51 | |||
52 | #define cmpxchg(ptr, o, n) \ | ||
53 | ({ \ | ||
54 | __typeof__(*(ptr)) _o_ = (o); \ | ||
55 | __typeof__(*(ptr)) _n_ = (n); \ | ||
56 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
57 | (unsigned long)_n_, sizeof(*(ptr)));\ | ||
58 | }) | ||
59 | |||
60 | #define cmpxchg64(ptr, o, n) \ | ||
61 | ({ \ | ||
62 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
63 | cmpxchg((ptr), (o), (n)); \ | ||
64 | }) | ||
65 | |||
66 | #undef __ASM__MB | ||
67 | #undef ____cmpxchg | ||
68 | |||
69 | #define __HAVE_ARCH_CMPXCHG 1 | ||
70 | |||
71 | #endif /* _ALPHA_CMPXCHG_H */ | ||
diff --git a/arch/alpha/include/asm/xchg.h b/arch/alpha/include/asm/xchg.h index 1d1b436fbff2..0ca9724597c1 100644 --- a/arch/alpha/include/asm/xchg.h +++ b/arch/alpha/include/asm/xchg.h | |||
@@ -1,10 +1,10 @@ | |||
1 | #ifndef _ALPHA_ATOMIC_H | 1 | #ifndef _ALPHA_CMPXCHG_H |
2 | #error Do not include xchg.h directly! | 2 | #error Do not include xchg.h directly! |
3 | #else | 3 | #else |
4 | /* | 4 | /* |
5 | * xchg/xchg_local and cmpxchg/cmpxchg_local share the same code | 5 | * xchg/xchg_local and cmpxchg/cmpxchg_local share the same code |
6 | * except that local version do not have the expensive memory barrier. | 6 | * except that local version do not have the expensive memory barrier. |
7 | * So this file is included twice from asm/system.h. | 7 | * So this file is included twice from asm/cmpxchg.h. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | /* | 10 | /* |