public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] riscv: ptrace: avoid BIT() in UAPI header
@ 2026-03-30  2:42 Michael Neuling
  2026-03-30  3:05 ` Michael Neuling
  2026-03-30  8:16 ` Andreas Schwab
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Neuling @ 2026-03-30  2:42 UTC (permalink / raw)
  To: pjw, palmer, aou
  Cc: alex, debug, thecharlesjenkins, linux-riscv, linux-kernel, mikey

BIT() is not available in UAPI headers — the installed linux/bits.h
(UAPI version) does not define it. Replace BIT() with open-coded
(1UL << x) which is the standard practice for UAPI headers, and drop
the linux/bits.h include that was added by commit 98545620b0 ("riscv:
ptrace: Fix BIT() compilation issues").

Fixes: 98545620b0 ("riscv: ptrace: Fix BIT() compilation issues")
Signed-off-by: Michael Neuling <mikey@neuling.org>
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---
 arch/riscv/include/uapi/asm/ptrace.h | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/riscv/include/uapi/asm/ptrace.h b/arch/riscv/include/uapi/asm/ptrace.h
index 5b53cea143..7cbd558b9b 100644
--- a/arch/riscv/include/uapi/asm/ptrace.h
+++ b/arch/riscv/include/uapi/asm/ptrace.h
@@ -8,7 +8,6 @@
 
 #ifndef __ASSEMBLER__
 
-#include <linux/bits.h>
 #include <linux/types.h>
 
 #define PTRACE_GETFDPIC		33
@@ -139,12 +138,12 @@ struct __sc_riscv_cfi_state {
 #define PTRACE_CFI_SS_LOCK_BIT	4
 #define PTRACE_CFI_SS_PTR_BIT	5
 
-#define PTRACE_CFI_LP_EN_STATE		BIT(PTRACE_CFI_LP_EN_BIT)
-#define PTRACE_CFI_LP_LOCK_STATE	BIT(PTRACE_CFI_LP_LOCK_BIT)
-#define PTRACE_CFI_ELP_STATE		BIT(PTRACE_CFI_ELP_BIT)
-#define PTRACE_CFI_SS_EN_STATE		BIT(PTRACE_CFI_SS_EN_BIT)
-#define PTRACE_CFI_SS_LOCK_STATE	BIT(PTRACE_CFI_SS_LOCK_BIT)
-#define PTRACE_CFI_SS_PTR_STATE		BIT(PTRACE_CFI_SS_PTR_BIT)
+#define PTRACE_CFI_LP_EN_STATE		(1UL << PTRACE_CFI_LP_EN_BIT)
+#define PTRACE_CFI_LP_LOCK_STATE	(1UL << PTRACE_CFI_LP_LOCK_BIT)
+#define PTRACE_CFI_ELP_STATE		(1UL << PTRACE_CFI_ELP_BIT)
+#define PTRACE_CFI_SS_EN_STATE		(1UL << PTRACE_CFI_SS_EN_BIT)
+#define PTRACE_CFI_SS_LOCK_STATE	(1UL << PTRACE_CFI_SS_LOCK_BIT)
+#define PTRACE_CFI_SS_PTR_STATE		(1UL << PTRACE_CFI_SS_PTR_BIT)
 
 #define PRACE_CFI_STATE_INVALID_MASK	~(PTRACE_CFI_LP_EN_STATE | \
 					  PTRACE_CFI_LP_LOCK_STATE | \
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] riscv: ptrace: avoid BIT() in UAPI header
  2026-03-30  2:42 [PATCH] riscv: ptrace: avoid BIT() in UAPI header Michael Neuling
@ 2026-03-30  3:05 ` Michael Neuling
  2026-03-30  8:16 ` Andreas Schwab
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Neuling @ 2026-03-30  3:05 UTC (permalink / raw)
  To: pjw, palmer, aou
  Cc: alex, debug, thecharlesjenkins, linux-riscv, linux-kernel

Paul,

> Fixes: 98545620b0 ("riscv: ptrace: Fix BIT() compilation issues")

This is fixing a patch in queued in the for-next branch. So this could be taken
on top of that patch or merged with that patch to avoid the issue to start with
but that would need for-next to be rebased.

Mikey

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] riscv: ptrace: avoid BIT() in UAPI header
  2026-03-30  2:42 [PATCH] riscv: ptrace: avoid BIT() in UAPI header Michael Neuling
  2026-03-30  3:05 ` Michael Neuling
@ 2026-03-30  8:16 ` Andreas Schwab
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2026-03-30  8:16 UTC (permalink / raw)
  To: Michael Neuling
  Cc: pjw, palmer, aou, alex, debug, thecharlesjenkins, linux-riscv,
	linux-kernel

On Mär 30 2026, Michael Neuling wrote:

> BIT() is not available in UAPI headers — the installed linux/bits.h
> (UAPI version) does not define it. Replace BIT() with open-coded
> (1UL << x) which is the standard practice for UAPI headers, and drop
> the linux/bits.h include that was added by commit 98545620b0 ("riscv:
> ptrace: Fix BIT() compilation issues").

There is also the _BITUL macro, which may be preferable.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-30  8:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30  2:42 [PATCH] riscv: ptrace: avoid BIT() in UAPI header Michael Neuling
2026-03-30  3:05 ` Michael Neuling
2026-03-30  8:16 ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox