OSDN Git Service

s390/cmpxchg: use unsigned long values instead of void pointers
authorHeiko Carstens <hca@linux.ibm.com>
Tue, 13 Apr 2021 09:23:30 +0000 (11:23 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Thu, 15 Apr 2021 15:47:41 +0000 (17:47 +0200)
commit13525f0a62cc258b2b2266478cc5fec0a45d1e71
tree1b2356d157dd983e5d457bd6c53cb5431cf50ae4
parent9d42a4d3e27db3cabad82483ed876d4c8b8bed65
s390/cmpxchg: use unsigned long values instead of void pointers

gcc and clang warn about incompatible pointer types due to the recent
cmpxchg changes:

drivers/gpu/drm/drm_lock.c:75:10: error: passing 'typeof (lock)' (aka 'volatile unsigned int *') to parameter of type 'void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
                   prev = cmpxchg(lock, old, new);
                          ^~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/atomic-instrumented.h:1685:2: note: expanded from macro 'cmpxchg'
           arch_cmpxchg(__ai_ptr, __VA_ARGS__); \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To avoid this simply cast pointers to unsigned long and use them
instead of void pointers. This allows to stay with functions, instead
of using complex defines and having to deal with all their potential
side effects.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: d2b1f6d2d350 ("s390/cmpxchg: get rid of gcc atomic builtins")
Link: https://lore.kernel.org/linux-s390/202104130131.sMmSqpb5-lkp@intel.com/
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/cmpxchg.h