checkpatch: DEFINE_ macros are real definitions for exports
When we want to confirm an export is directly after its definition we need to allow for DEFINE_ style macros. Add these to the execeptions. Refactor the exceptions. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
bf30d6ede0
commit
4801205864
1 changed files with 8 additions and 7 deletions
|
@ -1573,13 +1573,14 @@ sub process {
|
||||||
if (($line =~ /EXPORT_SYMBOL.*\((.*)\)/) ||
|
if (($line =~ /EXPORT_SYMBOL.*\((.*)\)/) ||
|
||||||
($line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) {
|
($line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) {
|
||||||
my $name = $1;
|
my $name = $1;
|
||||||
if (($prevline !~ /^}/) &&
|
if ($prevline !~ /(?:
|
||||||
($prevline !~ /^\+}/) &&
|
^.}|
|
||||||
($prevline !~ /^ }/) &&
|
^.DEFINE_$Ident\(\Q$name\E\)|
|
||||||
($prevline !~ /^.DECLARE_$Ident\(\Q$name\E\)/) &&
|
^.DECLARE_$Ident\(\Q$name\E\)|
|
||||||
($prevline !~ /^.LIST_HEAD\(\Q$name\E\)/) &&
|
^.LIST_HEAD\(\Q$name\E\)|
|
||||||
($prevline !~ /^.$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(/) &&
|
^.$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(|
|
||||||
($prevline !~ /\b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=|\[)/)) {
|
\b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=|\[)
|
||||||
|
)/x) {
|
||||||
WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr);
|
WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue