Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sparc64: Rework xchg() definition to avoid warnings.

Such as:

fs/ocfs2/file.c: In function ‘ocfs2_file_write_iter’:
./arch/sparc/include/asm/cmpxchg_64.h:55:22: warning: value computed is not used [-Wunused-value]
#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))

and

drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c: In function ‘ixgbevf_xdp_setup’:
./arch/sparc/include/asm/cmpxchg_64.h:55:22: warning: value computed is not used [-Wunused-value]
#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))

Signed-off-by: David S. Miller <davem@davemloft.net>

+6 -1
+6 -1
arch/sparc/include/asm/cmpxchg_64.h
··· 52 52 return val; 53 53 } 54 54 55 - #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) 55 + #define xchg(ptr,x) \ 56 + ({ __typeof__(*(ptr)) __ret; \ 57 + __ret = (__typeof__(*(ptr))) \ 58 + __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))); \ 59 + __ret; \ 60 + }) 56 61 57 62 void __xchg_called_with_bad_pointer(void); 58 63