Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757915AbbFQQhb (ORCPT ); Wed, 17 Jun 2015 12:37:31 -0400 Received: from foss.arm.com ([217.140.101.70]:40250 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755156AbbFQQhX (ORCPT ); Wed, 17 Jun 2015 12:37:23 -0400 From: Andre Przywara To: rmk+kernel@arm.linux.org.uk Cc: will.deacon@arm.com, Mark Hambleton , 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 Message-Id: <1434559056-20558-1-git-send-email-andre.przywara@arm.com> X-Mailer: git-send-email 2.3.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1869 Lines: 55 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 Cc: Mark Hambleton --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/