[PATCH 3/9] arm64: sysreg: Reject a Sysreg and a SysregFields with the same name

From: Fuad Tabba

Date: Mon Nov 23 2026 - 02:53:13 EST


The generator rejects two Sysreg blocks, or two SysregFields blocks,
with the same name, but tracks the two kinds separately. Both kinds name
their macros for the block, so a Sysreg FOO and a SysregFields FOO that
each have a field A both define FOO_A, as well as FOO_RES0 and the other
masks, and the compiler warns only where the definitions differ.

Track both kinds of name in defined_regs, so that a block is rejected
when either kind already has its name, and leave the kind out of the
error.

Suggested-by: Mark Rutland <mark.rutland@xxxxxxx>
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
---
arch/arm64/tools/gen-sysreg.awk | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/tools/gen-sysreg.awk b/arch/arm64/tools/gen-sysreg.awk
index b299342463631..8ce4981273dd3 100755
--- a/arch/arm64/tools/gen-sysreg.awk
+++ b/arch/arm64/tools/gen-sysreg.awk
@@ -137,9 +137,9 @@ $1 == "SysregFields" && block_current() == "Root" {
res1 = "UL(0)"
unkn = "UL(0)"

- if (reg in defined_fields)
- fatal("Duplicate SysregFields definition for " reg)
- defined_fields[reg] = 1
+ if (reg in defined_regs)
+ fatal("Duplicate definition for " reg)
+ defined_regs[reg] = 1

next_bit = 63

@@ -181,7 +181,7 @@ $1 == "Sysreg" && block_current() == "Root" {
unkn = "UL(0)"

if (reg in defined_regs)
- fatal("Duplicate Sysreg definition for " reg)
+ fatal("Duplicate definition for " reg)
defined_regs[reg] = 1

define_reg("REG_" reg, "S" op0 "_" op1 "_C" crn "_C" crm "_" op2)
--
2.47.3