diff options
author | Mark Hambleton <mahamble@broadcom.com> | 2013-12-03 14:19:12 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2013-12-19 12:44:05 -0500 |
commit | 60010e508111b2fd3d73de56f3b2c2bfc0f9eba1 (patch) | |
tree | ea8b6fc26647563fa615766b361990ab15a3d6a1 /arch/arm64/include | |
parent | ee6214cec7818867f368c35843ea1f3dffcbb57c (diff) |
arm64: cmpxchg: update macros to prevent warnings
Make sure the value we are going to return is referenced in order to
avoid warnings from newer GCCs such as:
arch/arm64/include/asm/cmpxchg.h:162:3: warning: value computed is not used [-Wunused-value]
((__typeof__(*(ptr)))__cmpxchg_mb((ptr), \
^
net/netfilter/nf_conntrack_core.c:674:2: note: in expansion of macro ‘cmpxchg’
cmpxchg(&nf_conntrack_hash_rnd, 0, rand);
[Modified to use the current underlying implementation as current
mainline for both cmpxchg() and cmpxchg_local() does -- broonie]
Signed-off-by: Mark Hambleton <mahamble@broadcom.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/include')
-rw-r--r-- | arch/arm64/include/asm/cmpxchg.h | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h index 3914c0dcd09c..56166d7f4a25 100644 --- a/arch/arm64/include/asm/cmpxchg.h +++ b/arch/arm64/include/asm/cmpxchg.h | |||
@@ -158,17 +158,23 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old, | |||
158 | return ret; | 158 | return ret; |
159 | } | 159 | } |
160 | 160 | ||
161 | #define cmpxchg(ptr,o,n) \ | 161 | #define cmpxchg(ptr, o, n) \ |
162 | ((__typeof__(*(ptr)))__cmpxchg_mb((ptr), \ | 162 | ({ \ |
163 | (unsigned long)(o), \ | 163 | __typeof__(*(ptr)) __ret; \ |
164 | (unsigned long)(n), \ | 164 | __ret = (__typeof__(*(ptr))) \ |
165 | sizeof(*(ptr)))) | 165 | __cmpxchg_mb((ptr), (unsigned long)(o), (unsigned long)(n), \ |
166 | 166 | sizeof(*(ptr))); \ | |
167 | #define cmpxchg_local(ptr,o,n) \ | 167 | __ret; \ |
168 | ((__typeof__(*(ptr)))__cmpxchg((ptr), \ | 168 | }) |
169 | (unsigned long)(o), \ | 169 | |
170 | (unsigned long)(n), \ | 170 | #define cmpxchg_local(ptr, o, n) \ |
171 | sizeof(*(ptr)))) | 171 | ({ \ |
172 | __typeof__(*(ptr)) __ret; \ | ||
173 | __ret = (__typeof__(*(ptr))) \ | ||
174 | __cmpxchg((ptr), (unsigned long)(o), \ | ||
175 | (unsigned long)(n), sizeof(*(ptr))); \ | ||
176 | __ret; \ | ||
177 | }) | ||
172 | 178 | ||
173 | #define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n)) | 179 | #define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n)) |
174 | #define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n)) | 180 | #define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n)) |