aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2015-04-16 15:44:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-17 09:03:57 -0400
commit0e212e0a720601fabda102f7998d27625f9e144a (patch)
treeb50a8c487d3484a9e1d3ae16bae49d887558dd9c /scripts
parentab7e23f3448e55f4808f443a7b98ded6707701bb (diff)
checkpatch: don't ask for asm/file.h to linux/file.h unconditionally
Currently checkpatch warns when asm/file.h is included and linux/file.h exists. That conversion can be made when linux/file.h includes asm/file.h which is not always the case.(See signal.h) Signed-off-by: Fabian Frederick <fabf@skynet.be> Cc: Andy Whitcroft <apw@canonical.com> Acked-by: Joe Perches <joe@perches.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.pl18
1 files changed, 11 insertions, 7 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d54a814a4bc8..c72e7ee1000b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4242,7 +4242,8 @@ sub process {
4242 } 4242 }
4243 } 4243 }
4244 4244
4245#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) 4245# warn if <asm/foo.h> is #included and <linux/foo.h> is available and includes
4246# itself <asm/foo.h> (uses RAW line)
4246 if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) { 4247 if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {
4247 my $file = "$1.h"; 4248 my $file = "$1.h";
4248 my $checkfile = "include/linux/$file"; 4249 my $checkfile = "include/linux/$file";
@@ -4250,12 +4251,15 @@ sub process {
4250 $realfile ne $checkfile && 4251 $realfile ne $checkfile &&
4251 $1 !~ /$allowed_asm_includes/) 4252 $1 !~ /$allowed_asm_includes/)
4252 { 4253 {
4253 if ($realfile =~ m{^arch/}) { 4254 my $asminclude = `grep -Ec "#include\\s+<asm/$file>" $root/$checkfile`;
4254 CHK("ARCH_INCLUDE_LINUX", 4255 if ($asminclude > 0) {
4255 "Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr); 4256 if ($realfile =~ m{^arch/}) {
4256 } else { 4257 CHK("ARCH_INCLUDE_LINUX",
4257 WARN("INCLUDE_LINUX", 4258 "Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
4258 "Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr); 4259 } else {
4260 WARN("INCLUDE_LINUX",
4261 "Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
4262 }
4259 } 4263 }
4260 } 4264 }
4261 } 4265 }