[PATCH] checkpatch: Ignore attribute macros ending with nGnRnE or nGnRE
From: Liu Dalin
Date: Sat Mar 07 2026 - 02:29:03 EST
On arm and arm64 platforms, there are several attribute macros that
end with nGnRnE or nGnRE, such as PROT_DEVICE_nGnRnE, PROT_DEVICE_nGnRE,
MT_DEVICE_nGnRnE, and MT_DEVICE_nGnRE.
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..f5b5d72cb069 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 macros end with nGnRnE or nGnRE
+#(ie: PROT_DEVICE_<foo>, MT_DEVICE_<foo> MT_S2_DEVICE_<foo> ...)
+ $var !~ /^[A-Z0-9_]+_(nGnRnE|nGnRE)$/) {
while ($var =~ m{\b($Ident)}g) {
my $word = $1;
next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/);
--
2.43.0