Skip to content

Commit

Permalink
checkpatch: fix wildcard DT compatible string checking
Browse files Browse the repository at this point in the history
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: Alexandre Belloni <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Tested-by: Geert Uytterhoeven <[email protected]>
Cc: Florian Vaussard <[email protected]>
Cc: Joe Perches <[email protected]>
Cc: Andy Whitcroft <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
robherring authored and torvalds committed Jun 4, 2014
1 parent 6516a46 commit 185d566
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2093,8 +2093,10 @@ sub process {

foreach my $compat (@compats) {
my $compat2 = $compat;
$compat2 =~ s/\,[a-z]*\-/\,<\.\*>\-/;
`grep -Erq "$compat|$compat2" $dt_path`;
$compat2 =~ s/\,[a-zA-Z0-9]*\-/\,<\.\*>\-/;
my $compat3 = $compat;
$compat3 =~ s/\,([a-z]*)[0-9]*\-/\,$1<\.\*>\-/;
`grep -Erq "$compat|$compat2|$compat3" $dt_path`;
if ( $? >> 8 ) {
WARN("UNDOCUMENTED_DT_STRING",
"DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr);
Expand Down

0 comments on commit 185d566

Please sign in to comment.