diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2012-05-29 02:28:38 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-05-30 03:07:56 -0400 |
commit | 6b894a409e8c0fcbd0ea30f5b013e33b9c4b28a1 (patch) | |
tree | a8f7ccdac4e6a152a41f11e804519f7f13af913a /arch/s390/include | |
parent | 0c44ca71f59447a5e602c45728829d1cb6a1b4b5 (diff) |
s390/cmpxchg: fix compile warnings specific to s390
The cmpxchg macros and functions are a bit different than on other
architectures. In particular the macros do not store the return
value of a __cmpxchg function call in a variable before returning the
value.
This causes compile warnings that only occur on s390 like this one:
net/ipv4/af_inet.c: In function 'build_ehash_secret':
net/ipv4/af_inet.c:241:2: warning: value computed is not used [-Wunused-value]
To get rid of these warnings use the same construct that we already use
for the xchg macro, which was introduced for the same reason.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include')
-rw-r--r-- | arch/s390/include/asm/cmpxchg.h | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/arch/s390/include/asm/cmpxchg.h b/arch/s390/include/asm/cmpxchg.h index ebd31481f1d2..13c8b2eb6983 100644 --- a/arch/s390/include/asm/cmpxchg.h +++ b/arch/s390/include/asm/cmpxchg.h | |||
@@ -160,9 +160,14 @@ static inline unsigned long __cmpxchg(void *ptr, unsigned long old, | |||
160 | return old; | 160 | return old; |
161 | } | 161 | } |
162 | 162 | ||
163 | #define cmpxchg(ptr, o, n) \ | 163 | #define cmpxchg(ptr, o, n) \ |
164 | ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \ | 164 | ({ \ |
165 | (unsigned long)(n), sizeof(*(ptr)))) | 165 | __typeof__(*(ptr)) __ret; \ |
166 | __ret = (__typeof__(*(ptr))) \ | ||
167 | __cmpxchg((ptr), (unsigned long)(o), (unsigned long)(n), \ | ||
168 | sizeof(*(ptr))); \ | ||
169 | __ret; \ | ||
170 | }) | ||
166 | 171 | ||
167 | #ifdef CONFIG_64BIT | 172 | #ifdef CONFIG_64BIT |
168 | #define cmpxchg64(ptr, o, n) \ | 173 | #define cmpxchg64(ptr, o, n) \ |
@@ -184,10 +189,16 @@ static inline unsigned long long __cmpxchg64(void *ptr, | |||
184 | : "memory", "cc"); | 189 | : "memory", "cc"); |
185 | return rp_old.pair; | 190 | return rp_old.pair; |
186 | } | 191 | } |
187 | #define cmpxchg64(ptr, o, n) \ | 192 | |
188 | ((__typeof__(*(ptr)))__cmpxchg64((ptr), \ | 193 | #define cmpxchg64(ptr, o, n) \ |
189 | (unsigned long long)(o), \ | 194 | ({ \ |
190 | (unsigned long long)(n))) | 195 | __typeof__(*(ptr)) __ret; \ |
196 | __ret = (__typeof__(*(ptr))) \ | ||
197 | __cmpxchg64((ptr), \ | ||
198 | (unsigned long long)(o), \ | ||
199 | (unsigned long long)(n)); \ | ||
200 | __ret; \ | ||
201 | }) | ||
191 | #endif /* CONFIG_64BIT */ | 202 | #endif /* CONFIG_64BIT */ |
192 | 203 | ||
193 | #include <asm-generic/cmpxchg-local.h> | 204 | #include <asm-generic/cmpxchg-local.h> |
@@ -216,8 +227,13 @@ static inline unsigned long __cmpxchg_local(void *ptr, | |||
216 | * them available. | 227 | * them available. |
217 | */ | 228 | */ |
218 | #define cmpxchg_local(ptr, o, n) \ | 229 | #define cmpxchg_local(ptr, o, n) \ |
219 | ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \ | 230 | ({ \ |
220 | (unsigned long)(n), sizeof(*(ptr)))) | 231 | __typeof__(*(ptr)) __ret; \ |
232 | __ret = (__typeof__(*(ptr))) \ | ||
233 | __cmpxchg_local((ptr), (unsigned long)(o), \ | ||
234 | (unsigned long)(n), sizeof(*(ptr))); \ | ||
235 | __ret; \ | ||
236 | }) | ||
221 | 237 | ||
222 | #define cmpxchg64_local(ptr, o, n) cmpxchg64((ptr), (o), (n)) | 238 | #define cmpxchg64_local(ptr, o, n) cmpxchg64((ptr), (o), (n)) |
223 | 239 | ||