lkml.org 
[lkml]   [2021]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/4] sh: convert xchg() to a statement expression
Date
Use a GCC statement expression (extension) for xchg(), as is done
in other arches.

Fixes this build warning:

../fs/ocfs2/file.c: In function 'ocfs2_file_write_iter':
../arch/sh/include/asm/cmpxchg.h:49:3: warning: value computed is not used [-Wunused-value]
49 | ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr))))

Fixes: e839ca528718 ("Disintegrate asm/system.h for SH")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>
---
This is similar to a patch from Arnd for m68k:
https://lore.kernel.org/linux-m68k/20201008123429.1133896-1-arnd@arndb.de/

arch/sh/include/asm/cmpxchg.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20210528.orig/arch/sh/include/asm/cmpxchg.h
+++ linux-next-20210528/arch/sh/include/asm/cmpxchg.h
@@ -46,7 +46,7 @@ extern void __xchg_called_with_bad_point
})

#define xchg(ptr,x) \
- ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr))))
+ ({(__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr)));})

/* This function doesn't exist, so you'll get a linker error
* if something tries to do an invalid cmpxchg(). */
\
 
 \ /
  Last update: 2021-06-03 01:15    [W:0.082 / U:0.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site