@@ -700,8 +700,9 @@ __cmpxchg_acquire(void *ptr, unsigned long old, unsigned long new,
({ \
__typeof__(*(ptr)) _o_ = (o); \
__typeof__(*(ptr)) _n_ = (n); \
- (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
- (unsigned long)_n_, sizeof(*(ptr))); \
+ (__force __typeof__(*(ptr))) \
+ __cmpxchg((ptr), (__force unsigned long)_o_, \
+ (__force unsigned long)_n_, sizeof(*(ptr))); \
})
@@ -709,26 +710,27 @@ __cmpxchg_acquire(void *ptr, unsigned long old, unsigned long new,
({ \
__typeof__(*(ptr)) _o_ = (o); \
__typeof__(*(ptr)) _n_ = (n); \
- (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \
- (unsigned long)_n_, sizeof(*(ptr))); \
+ (__force __typeof__(*(ptr))) \
+ __cmpxchg_local((ptr), (__force unsigned long)_o_, \
+ (__force unsigned long)_n_, sizeof(*(ptr))); \
})
#define arch_cmpxchg_relaxed(ptr, o, n) \
({ \
__typeof__(*(ptr)) _o_ = (o); \
__typeof__(*(ptr)) _n_ = (n); \
- (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr), \
- (unsigned long)_o_, (unsigned long)_n_, \
- sizeof(*(ptr))); \
+ (__force __typeof__(*(ptr))) \
+ __cmpxchg_relaxed((ptr), (__force unsigned long)_o_, \
+ (__force unsigned long)_n_, sizeof(*(ptr)));\
})
#define arch_cmpxchg_acquire(ptr, o, n) \
({ \
__typeof__(*(ptr)) _o_ = (o); \
__typeof__(*(ptr)) _n_ = (n); \
- (__typeof__(*(ptr))) __cmpxchg_acquire((ptr), \
- (unsigned long)_o_, (unsigned long)_n_, \
- sizeof(*(ptr))); \
+ (__force __typeof__(*(ptr))) \
+ __cmpxchg_acquire((ptr), (__force unsigned long)_o_, \
+ (__force unsigned long)_n_, sizeof(*(ptr)));\
})
#ifdef CONFIG_PPC64
#define arch_cmpxchg64(ptr, o, n) \
Powerpc arch_cmpxchg() wrapper macros cast arguments to 'unsigned long' before calling the functions implementing the operation. Some type annotations (e.g. __bitwise) generate sparse warnings like: block/blk-crypto-fallback.c:164:17: warning: cast from restricted blk_status_t block/blk-crypto-fallback.c:164:17: warning: cast to restricted blk_status_t Force casting in the macros to avoid the warnings: Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202606012339.rZAl6Xq8-lkp@intel.com/ Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org> --- arch/powerpc/include/asm/cmpxchg.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)