aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2014-12-10 18:51:54 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-10 20:41:12 -0500
commitf512357646268451da0d7e1e0100c55df6c8cea6 (patch)
treeffbc2b97e5e37b01e4479be979c1ef8d6eee540c /scripts
parentea4acbb11e32a2a1e7d80aa3d3039f909647ceee (diff)
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 <jwerner@chromium.org> Acked-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl4
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 893cbd517f89..518cc2e58439 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4104,7 +4104,9 @@ sub process {
4104#Ignore Page<foo> variants 4104#Ignore Page<foo> variants
4105 $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ && 4105 $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
4106#Ignore SI style variants like nS, mV and dB (ie: max_uV, regulator_min_uA_show) 4106#Ignore SI style variants like nS, mV and dB (ie: max_uV, regulator_min_uA_show)
4107 $var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/) { 4107 $var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/ &&
4108#Ignore some three character SI units explicitly, like MiB and KHz
4109 $var !~ /^(?:[a-z_]*?)_?(?:[KMGT]iB|[KMGT]?Hz)(?:_[a-z_]+)?$/) {
4108 while ($var =~ m{($Ident)}g) { 4110 while ($var =~ m{($Ident)}g) {
4109 my $word = $1; 4111 my $word = $1;
4110 next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/); 4112 next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/);