[PATCH 1/1] checkpatch: ignore memory attribute macros ending with nGnRnE, nGnRE, or nGRE

From: Liu Dalin

Date: Sun Mar 08 2026 - 22:50:21 EST


On arm and arm64 platforms, there exist several memory attribute macros
that end with nGnRnE, nGnRE, or nGRE. Examples include:
- PROT_DEVICE_nGnRnE, PROT_DEVICE_nGnRE
- FFA_DEV_nGnRnE, FFA_DEV_nGnRE, FFA_DEV_nGRE

Signed-off-by: Liu Dalin <liudalin@xxxxxxxxxxxxxxx>
---
scripts/checkpatch.pl | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e56374662ff7..2ea7b130e913 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5896,7 +5896,10 @@ sub process {
#(ie: max_uV, regulator_min_uA_show, RANGE_mA_VALUE)
$var !~ /^(?:[a-z0-9_]*|[A-Z0-9_]*)?_?[a-z][A-Z](?:_[a-z0-9_]+|_[A-Z0-9_]+)?$/ &&
#Ignore some three character SI units explicitly, like MiB and KHz
- $var !~ /^(?:[a-z_]*?)_?(?:[KMGT]iB|[KMGT]?Hz)(?:_[a-z_]+)?$/) {
+ $var !~ /^(?:[a-z_]*?)_?(?:[KMGT]iB|[KMGT]?Hz)(?:_[a-z_]+)?$/ &&
+#Ignore memory attribute macros that end with nGnRnE, nGnRE, or nGRE
+#(ie: PROT_DEVICE_<foo>, FFA_DEV_<foo> MT_S2_DEVICE_<foo> ...)
+ $var !~/^[A-Z0-9_]+_(?:nGnRnE|nGnRE|nGRE)$/) {
while ($var =~ m{\b($Ident)}g) {
my $word = $1;
next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/);
--
2.43.0