Commit 185d566b authored by Rob Herring's avatar Rob Herring Committed by Linus Torvalds

checkpatch: fix wildcard DT compatible string checking

We attempt to search for compatible strings which use a variable token in
the documented name such as <chip> or <soc>.  While this was attempted to
be handled, it's utterly broken.

The desired forms of matching are:

vendor,<chip>-*
vendor,name<part#>-*

For <chip>, lower case characters and numbers are permitted.  For <part#>,
only numeric values are allowed.

With this change, the number of missing compatible strings reported in
arch/arm/boot/dts is reduced from 1071 to 960.
Reported-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Tested-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Cc: Florian Vaussard <florian.vaussard@epfl.ch>
Cc: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6516a466
...@@ -2093,8 +2093,10 @@ sub process { ...@@ -2093,8 +2093,10 @@ sub process {
foreach my $compat (@compats) { foreach my $compat (@compats) {
my $compat2 = $compat; my $compat2 = $compat;
$compat2 =~ s/\,[a-z]*\-/\,<\.\*>\-/; $compat2 =~ s/\,[a-zA-Z0-9]*\-/\,<\.\*>\-/;
`grep -Erq "$compat|$compat2" $dt_path`; my $compat3 = $compat;
$compat3 =~ s/\,([a-z]*)[0-9]*\-/\,$1<\.\*>\-/;
`grep -Erq "$compat|$compat2|$compat3" $dt_path`;
if ( $? >> 8 ) { if ( $? >> 8 ) {
WARN("UNDOCUMENTED_DT_STRING", WARN("UNDOCUMENTED_DT_STRING",
"DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr); "DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr);
......
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