From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754182AbbJNPBy (ORCPT ); Wed, 14 Oct 2015 11:01:54 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:52523 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751947AbbJNPBw (ORCPT ); Wed, 14 Oct 2015 11:01:52 -0400 From: Arnd Bergmann To: Marek Vasut Cc: linux-kernel@vger.kernel.org, lftan@altera.com, linux-arch@vger.kernel.org, Russell King Subject: Re: [PATCH] asm-generic: cmpxchg: avoid warnings from macro-ized cmpxchg() implementations Date: Wed, 14 Oct 2015 17:01:45 +0200 Message-ID: <50122244.xQZES6VAKE@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1442637741-10807-1-git-send-email-marex@denx.de> References: <1442637741-10807-1-git-send-email-marex@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:sROtuZ9eUZJXpDpAzNYKLPEhinZ9zxfzzZwJiE8x2gbk890ZIHI g1fgRcvofAJ1gtoLR9/2MJHd4HrlRRBHyYsTLNKptJwe6nq1H6GWCuKztpQ1nGiZsPIndtw jL3OJgFhHEnUVPuTtG96XRoDRdT1RSIcghsEgEkOWwgLVglw5YpzAN2/TmWM7bfTldkTeP8 rQmrY7UV4LrNCsHmh6QqQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:NU4Pm6sHWFg=:U8AcRCss1x9M63P3vmLe4M r+ojqunxtPrDjuT+RFpDr71FTbRavrVBu31QFkxrzt1AEKxYSz2s6fh7PaGvf9LA0/8SLReUL vmmXdjoLq7HGWkHGaXCd2juFd+cQlZBtcg7DK5g3XGxeMyWWJsiHSob7ClBeVw8Yh0soSPDMy uusr8T6iDL847WoYFKVU/vYbvkd2CnOeyINStw2HZf3z9DHGSrLP7jeNJXm+uek0iQ3a5Key9 7vmZqqScIeKWY3tX9QB8g+sShVDvWWO39kF5ChmJnvMq4/z67YvhCmK8d7tV1Cx9x5+9Qw0rx FL+6cr4LunJ5p10/3q+5zR4sMkNWWMQ0HktotbgNIVz6H9Nob1xtBnmbw5/5byhcHJ+RzLckx 2s7stpG2lEVGhWyhzSB8GKBH4Ut2BBhUu3nGDMVk14ZZcDtSFyhTvfXKGT2+py7On4/dxaCJ3 jT67n/8U1BI8b+Q9xkVagDnnQptOjOdwzn/pl7zZA8/U/Ho66PZGMTwF82pwTuMhi2FeNzn3V zKSafJfzfu5U6eesP7FEuV0NrlQtHjJRF3RSRFgoESfW4D8CEl6yIUmyzhR35VkVQVuxLqjIJ xF2wTdS43EX/LJHcFt/lor5tprg+PXrbqv5qR8Ako9udC/ny3ZkPhbhKxBJ4YN1x5PWr1tMmt GHikHYIuVhbPJk0sPQnr1gMa5e2vyG9w+U4uad+DJ1fMsCO5dLUYjtjaCiybcjg11fjjss1Vv FF7tqz+6Q7M7n3tv Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Saturday 19 September 2015 06:42:21 Marek Vasut wrote: > This change is similar to e001bbae7147b111fe1aa42beaf835635f3c016e > ARM: cmpxchg: avoid warnings from macro-ized cmpxchg() implementations > > A recent change in kernel/acct.c added a new warning for many > configurations using generic __xchg() implementation: > > In file included from ./arch/nios2/include/asm/cmpxchg.h:12:0, > from include/asm-generic/atomic.h:18, > from arch/nios2/include/generated/asm/atomic.h:1, > from include/linux/atomic.h:4, > from include/linux/spinlock.h:406, > from include/linux/mmzone.h:7, > from include/linux/gfp.h:5, > from include/linux/mm.h:9, > from kernel/acct.c:46: > kernel/acct.c: In function 'acct_pin_kill': > include/asm-generic/cmpxchg.h:94:3: warning: value computed is not used [-Wunused-value] > ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ > ^ > include/asm-generic/cmpxchg.h:102:28: note: in expansion of macro 'cmpxchg_local' > #define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n)) > ^ > kernel/acct.c:177:2: note: in expansion of macro 'cmpxchg' > cmpxchg(&acct->ns->bacct, pin, NULL); > ^ > > 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 asm-ggeneric 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. > > Fix the other macros in this file in a similar way, and place them > just below their function implementations. > > Signed-off-by: Marek Vasut > Cc: Russell King Applied to my asm-generic tree, thanks! Arnd