linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm: cmpxchg: update macro to prevent compiler warning
@ 2015-06-17 16:37 Andre Przywara
  2015-06-17 19:35 ` Russell King - ARM Linux
  0 siblings, 1 reply; 2+ messages in thread
From: Andre Przywara @ 2015-06-17 16:37 UTC (permalink / raw)
  To: linux-arm-kernel

In kernel/acct.c we call the cmpxchg() macro without using it's
return value, so the compiler complains when compiling for ARM:

kernel/acct.c: In function 'acct_pin_kill':
arch/arm/include/asm/cmpxchg.h:205:3: warning: value computed is not used [-Wunused-value]
  ((__typeof__(*(ptr)))__cmpxchg_mb((ptr),   \
   ^
kernel/acct.c:174:2: note: in expansion of macro 'cmpxchg'
  cmpxchg(&acct->ns->bacct, pin, NULL);
  ^

Rearrange the macro along the lines of a similar patch for arm64
60010e508111 ("arm64: cmpxchg: update macros to prevent warnings")
to fix the warning.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Cc: Mark Hambleton <Mark.Hambleton@arm.com>
---
 arch/arm/include/asm/cmpxchg.h | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h
index abb2c37..dc27aaf 100644
--- a/arch/arm/include/asm/cmpxchg.h
+++ b/arch/arm/include/asm/cmpxchg.h
@@ -201,11 +201,16 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
 	return ret;
 }
 
-#define cmpxchg(ptr,o,n)						\
-	((__typeof__(*(ptr)))__cmpxchg_mb((ptr),			\
-					  (unsigned long)(o),		\
-					  (unsigned long)(n),		\
-					  sizeof(*(ptr))))
+#define cmpxchg(ptr, o, n)						\
+({									\
+	__typeof__(*(ptr)) __ret;					\
+	__ret = (__typeof__(*(ptr)))					\
+		__cmpxchg_mb((ptr),					\
+			     (unsigned long)(o),			\
+			     (unsigned long)(n),			\
+			     sizeof(*(ptr)));				\
+	__ret;								\
+})
 
 static inline unsigned long __cmpxchg_local(volatile void *ptr,
 					    unsigned long old,
-- 
2.3.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] arm: cmpxchg: update macro to prevent compiler warning
  2015-06-17 16:37 [PATCH] arm: cmpxchg: update macro to prevent compiler warning Andre Przywara
@ 2015-06-17 19:35 ` Russell King - ARM Linux
  0 siblings, 0 replies; 2+ messages in thread
From: Russell King - ARM Linux @ 2015-06-17 19:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 17, 2015 at 05:37:36PM +0100, Andre Przywara wrote:
> In kernel/acct.c we call the cmpxchg() macro without using it's
> return value, so the compiler complains when compiling for ARM:

A fix is already queued, and has been queued since 26th May.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-17 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-17 16:37 [PATCH] arm: cmpxchg: update macro to prevent compiler warning Andre Przywara
2015-06-17 19:35 ` Russell King - ARM Linux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).