]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
sparc: make xchg() into a statement expression
authorRandy Dunlap <rdunlap@infradead.org>
Tue, 20 Oct 2020 05:33:28 +0000 (22:33 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Feb 2021 00:40:22 +0000 (16:40 -0800)
Fix several of the same warning by using a GCC statement expression
(extension):

../arch/sparc/include/asm/cmpxchg_32.h:28:22: warning: value computed is not used [-Wunused-value]
   28 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))

Passes sparc32 allmodconfig with no xchg warnings.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/include/asm/cmpxchg_32.h

index c73b5a3ab7b91f971d7ca9f3f09e7814fd113856..a53d744d4212507520c7b15958b8014f874caa4c 100644 (file)
@@ -25,7 +25,7 @@ static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int
        return x;
 }
 
-#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
+#define xchg(ptr,x) ({(__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)));})
 
 /* Emulate cmpxchg() the same way we emulate atomics,
  * by hashing the object address and indexing into an array