]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitfd824e61809c068a18d034631a27dbcf01715d8b
tree1b2356d157dd983e5d457bd6c53cb5431cf50ae4
parentb70394e8e5a6a5036b8b8dbf88fc2311b0fc64af
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: 8c39f75c6724 ("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