Commit 0e212e0a authored by Fabian Frederick's avatar Fabian Frederick Committed by Linus Torvalds

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: default avatarFabian Frederick <fabf@skynet.be>
Cc: Andy Whitcroft <apw@canonical.com>
Acked-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ab7e23f3
...@@ -4242,7 +4242,8 @@ sub process { ...@@ -4242,7 +4242,8 @@ sub process {
} }
} }
#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) # warn if <asm/foo.h> is #included and <linux/foo.h> is available and includes
# itself <asm/foo.h> (uses RAW line)
if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) { if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {
my $file = "$1.h"; my $file = "$1.h";
my $checkfile = "include/linux/$file"; my $checkfile = "include/linux/$file";
...@@ -4250,6 +4251,8 @@ sub process { ...@@ -4250,6 +4251,8 @@ sub process {
$realfile ne $checkfile && $realfile ne $checkfile &&
$1 !~ /$allowed_asm_includes/) $1 !~ /$allowed_asm_includes/)
{ {
my $asminclude = `grep -Ec "#include\\s+<asm/$file>" $root/$checkfile`;
if ($asminclude > 0) {
if ($realfile =~ m{^arch/}) { if ($realfile =~ m{^arch/}) {
CHK("ARCH_INCLUDE_LINUX", CHK("ARCH_INCLUDE_LINUX",
"Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr); "Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
...@@ -4259,6 +4262,7 @@ sub process { ...@@ -4259,6 +4262,7 @@ sub process {
} }
} }
} }
}
# multi-statement macros should be enclosed in a do while loop, grab the # multi-statement macros should be enclosed in a do while loop, grab the
# first statement and ensure its the whole macro if its not enclosed # first statement and ensure its the whole macro if its not enclosed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment