UPSTREAM: checkpatch: allow certain SI units with three characters

Checkpatch flags CamelCase identifiers in strict mode, but it has a
feature to ignore parts with only two characters to allow for SI units
like mV or uA.  Unfortunately, not all SI units fit in two characters, and
not all are lower case followed by upper case.

This patch adds hardcoded detection for frequency and 1024-based size
units (Hz/KHz/MHz/GHz/THz and KiB/MiB/GiB/TiB), since allowing any three
character combinations might be too lenient.  The list can later be
expanded as needed.

Signed-off-by: Julius Werner <>
Acked-by: Joe Perches <>
Cc: Andy Whitcroft <>
Signed-off-by: Andrew Morton <>
(cherry picked from commit 6fcece53765443add30da4b085085dfda2b22ff0)
Cherry-picked from next/linux-next.git/master.

TEST=./ --no-tree --strict -f
../third_party/coreboot/src/soc/rockchip/rk3288/include/soc/clock.h no
longer flags "MHz" as a CamelCase violation.

Change-Id: Ic5200ee7001a5f0a913f340b16bcce553d41f5f3
Signed-off-by: Julius Werner <>
Reviewed-by: Doug Anderson <>
diff --git a/ b/
index c197ac5..53653d6 100755
--- a/
+++ b/
@@ -2947,6 +2947,8 @@
 			    $var !~ /"^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
 #Ignore SI style variants like nS, mV and dB (ie: max_uV, regulator_min_uA_show)
 			    $var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/ &&
+#Ignore some three character SI units explicitly, like MiB and KHz
+			    $var !~ /^(?:[a-z_]*?)_?(?:[KMGT]iB|[KMGT]?Hz)(?:_[a-z_]+)?$/ &&
 			    !defined $camelcase{$var}) {
 				$camelcase{$var} = 1;