Skip to content

Commit 2ac73b4

Browse files
JoePerchestorvalds
authored andcommitted
checkpatch: make --strict a default for files in drivers/net and net/
Networking files are generally more strictly conformant to linux-kernel style so make checkpatch more verbose by default for patches to files or when checking files in these directories. Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Cc: David Miller <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 3f7bac0 commit 2ac73b4

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎scripts/checkpatch.pl‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
my $terse = 0;
2525
my $file = 0;
2626
my $check = 0;
27+
my $check_orig = 0;
2728
my $summary = 1;
2829
my $mailback = 0;
2930
my $summary_file = 0;
@@ -146,6 +147,7 @@ sub help {
146147
help(0) if ($help);
147148

148149
$fix = 1 if ($fix_inplace);
150+
$check_orig = $check;
149151

150152
my $exit = 0;
151153

@@ -1813,11 +1815,13 @@ sub process {
18131815
$here = "#$linenr: " if (!$file);
18141816
$here = "#$realline: " if ($file);
18151817

1818+
my $found_file = 0;
18161819
# extract the filename as it passes
18171820
if ($line =~ /^diff --git.*?(\S+)$/) {
18181821
$realfile = $1;
18191822
$realfile =~ s@^([^/]*)/@@ if (!$file);
18201823
$in_commit_log = 0;
1824+
$found_file = 1;
18211825
} elsif ($line =~ /^\+\+\+\s+(\S+)/) {
18221826
$realfile = $1;
18231827
$realfile =~ s@^([^/]*)/@@ if (!$file);
@@ -1834,6 +1838,15 @@ sub process {
18341838
ERROR("MODIFIED_INCLUDE_ASM",
18351839
"do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n");
18361840
}
1841+
$found_file = 1;
1842+
}
1843+
1844+
if ($found_file) {
1845+
if ($realfile =~ m@^(drivers/net/|net/)@) {
1846+
$check = 1;
1847+
} else {
1848+
$check = $check_orig;
1849+
}
18371850
next;
18381851
}
18391852

0 commit comments

Comments
 (0)