mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: rmk+kernel@arm.linux.org.uk
Cc: will.deacon@arm.com, Mark Hambleton <Mark.Hambleton@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] arm: cmpxchg: update macro to prevent compiler warning
Date: Wed, 17 Jun 2015 17:37:36 +0100	[thread overview]
Message-ID: <1434559056-20558-1-git-send-email-andre.przywara@arm.com> (raw)

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


             reply	other threads:[~2015-06-17 16:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-17 16:37 Andre Przywara [this message]
2015-06-17 19:35 ` Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434559056-20558-1-git-send-email-andre.przywara@arm.com \
    --to=andre.przywara@arm.com \
    --cc=Mark.Hambleton@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®