From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753938AbbELVaF (ORCPT ); Tue, 12 May 2015 17:30:05 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:49723 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752020AbbELVaD (ORCPT ); Tue, 12 May 2015 17:30:03 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Al Viro , Russell King - ARM Linux Subject: [PATCH] ARM: avoid cmpxchg warning in kernel/acct.c Date: Tue, 12 May 2015 23:29:32 +0200 Message-ID: <2137098.src0nTNAZ2@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:N0FmWqnyeBUfJed6Bo9Le3hSQ0BrcPqoOPX+KMbG7S3iPYobp31 Pe0HFZaqnEEre0415sBcijBHwgn/NcwZaItRhUkVVw1Vqxhz2oAj+iE1WH522JKKDDHi0i8 I5xPG5DFQdPVO/3AmhcfOnGS8O80BoCvk6YUyMdEvIJCv4IYRO+7ghiEEnFe99qFxhfU2LO W9Buspa0qOJ4lOg8RhR5w== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A recent change in kernel/acct.c added a new warning for many configurations on ARM: kernel/acct.c: In function 'acct_pin_kill': arch/arm/include/asm/cmpxchg.h:122:3: warning: value computed is not used [-Wunused-value] ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ The code is in fact correct, it's just a cmpxchg() call that intentionally ignores the result, and no other code does that. The warning does not show up on x86 because of the way that its cmpxchg() macro is written. This changes the ARM implementation to use a similar construct with a compound expression instead of a typecast, which causes the compiler to not complain about an unused result. Signed-off-by: Arnd Bergmann Fixes: 3b994d98a815 ("get rid of the second argument of acct_kill()") --- This helps build some of the ARM defconfigs without warnings once more. diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h index abb2c3769b01..04be894f7c4e 100644 --- a/arch/arm/include/asm/cmpxchg.h +++ b/arch/arm/include/asm/cmpxchg.h @@ -119,8 +119,8 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size * them available. */ #define cmpxchg_local(ptr, o, n) \ - ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ - (unsigned long)(n), sizeof(*(ptr)))) + ({(__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ + (unsigned long)(n), sizeof(*(ptr)));}) #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) #ifndef CONFIG_SMP @@ -202,10 +202,10 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old, } #define cmpxchg(ptr,o,n) \ - ((__typeof__(*(ptr)))__cmpxchg_mb((ptr), \ + ({(__typeof__(*(ptr)))__cmpxchg_mb((ptr), \ (unsigned long)(o), \ (unsigned long)(n), \ - sizeof(*(ptr)))) + sizeof(*(ptr)));}) static inline unsigned long __cmpxchg_local(volatile void *ptr, unsigned long old,