From nobody Tue Sep 29 02:33:47 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF19133EAF9 for ; Thu, 13 Aug 2026 08:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786609030; cv=none; b=BkA6WzrIanKGWmRpkT7TOuRNyk6kWErIjFCcADi1xbS2AFj2kTxikGwBc3TSGyvKiDd8uTs747vh8yVpV32CuHiWuceGnK3jJTWnPJe/N01DDX7uk2mDQqpRPp3Y+G4uIWnAQ/AEld2AfpC11Z+icI3tJNUZqdWUu6GJkzfpQVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786609030; c=relaxed/simple; bh=4mvMrpIZAkAXcVPWdMLSSPRhuOvefDeo4UeeoCigqWM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Q8Atpwttt6biWVP+3o8bxo+mfPwY+5lh0e/XHYUFVCY3Z931JOvTli22J/RcsDenoXwnpzf24FFlpHGufPkTcbKjZzX4s6ERH/tNJWwPGtLCbcFfqoLOvNjPaU26Hoxn5EUPYOjpzLAJRzDWUzggX0KNpbr6TrXg/VOr7+lL/rE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hOsXmEDQ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hOsXmEDQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0569E1F000E9; Thu, 13 Aug 2026 08:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786609029; bh=OBCEUWqwGxw/pU1xAkmBvx00nyMvNlJlQThBjZtx7/c=; h=From:To:Cc:Subject:Date; b=hOsXmEDQeXsxkBgDCazffc87Oi+RAGpdxNPkxAbJ5J88njdP3zLs0G+ohSUCHH1ak iZtVevb7a0+NRAHk84V8KFdRZoqHdULNIqbYJCpi5gY1piDmJCxja8m3VEgXCz843q BTZnonzeR4OJ5DNVfrkdt47hwSl0pmqicrU12FQyxdCBx0NP/0XLgoAWd7Gtf9Zl6v PbfcCA9M4Fct9UMqDmEsmZNG92iWfYIwhmO924j4hei4TzVmJzdiBzCiahbWSBCl2C oYVKurEUIUseJJmUk/TikLA40YDwHN/7MHVfEqAuJ/IlelETC1J43GDzkwQMh8WUpT /i9vroy3bfRgQ== From: "Christophe Leroy (CS GROUP)" To: Michael Ellerman , Nicholas Piggin , Madhavan Srinivasan Cc: "Christophe Leroy (CS GROUP)" , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kernel test robot Subject: [PATCH] powerpc: Silence sparse warnings caused by type casting in (cmp)xchg Date: Thu, 13 Aug 2026 10:16:46 +0200 Message-ID: <289a7ffac9cb5b6d26a57fdc26605bf725285302.1786608980.git.chleroy@kernel.org> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2850; i=chleroy@kernel.org; h=from:subject:message-id; bh=4mvMrpIZAkAXcVPWdMLSSPRhuOvefDeo4UeeoCigqWM=; b=owGbwMvMwCV2d0KB2p7V54MZT6slMWTV1hZeDi8Q1L/ufP95imiNYN2l9Q98bzzm3av03tO18 VaR/LPAjlIWBjEuBlkxRZbj/7l3zej6kpo/dZc+zBxWJpAhDFycAjCRM1sYGW6dWnDg2kfH9yZR XodCF+bwpnt9VT6uMV1ij8Cx+jRJphyG//5edavr1Wd84vS12h5yrudDkp/k40tOHX9CbJyjNp0 I5AcA X-Developer-Key: i=chleroy@kernel.org; a=openpgp; fpr=10FFE6F8B390DE17ACC2632368A92FEB01B8DD78 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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_sta= tus_t block/blk-crypto-fallback.c:164:17: warning: cast to restricted blk_statu= s_t Force casting in the macros to avoid the warnings: Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202606012339.rZAl6Xq8-lkp@int= el.com/ Signed-off-by: Christophe Leroy (CS GROUP) --- arch/powerpc/include/asm/cmpxchg.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/include/asm/cmpxchg.h b/arch/powerpc/include/asm/= cmpxchg.h index dbb50c06f0bf..7264e33ef877 100644 --- a/arch/powerpc/include/asm/cmpxchg.h +++ b/arch/powerpc/include/asm/cmpxchg.h @@ -700,8 +700,9 @@ __cmpxchg_acquire(void *ptr, unsigned long old, unsigne= d long new, ({ \ __typeof__(*(ptr)) _o_ =3D (o); \ __typeof__(*(ptr)) _n_ =3D (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))); \ }) =20 =20 @@ -709,26 +710,27 @@ __cmpxchg_acquire(void *ptr, unsigned long old, unsig= ned long new, ({ \ __typeof__(*(ptr)) _o_ =3D (o); \ __typeof__(*(ptr)) _n_ =3D (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))); \ }) =20 #define arch_cmpxchg_relaxed(ptr, o, n) \ ({ \ __typeof__(*(ptr)) _o_ =3D (o); \ __typeof__(*(ptr)) _n_ =3D (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)));\ }) =20 #define arch_cmpxchg_acquire(ptr, o, n) \ ({ \ __typeof__(*(ptr)) _o_ =3D (o); \ __typeof__(*(ptr)) _n_ =3D (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) \ --=20 2.54.0