History

checkpatch: improve the compatible vendor match

Improve the vendor name match in vendor-prefix.txt by only matching the exact vendor name at the beginning of lines.

Florian Vaussard committed 12 years ago

Commit cc933191 parent 7dd05b31 file · +5 −5Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+5−5
@@ -2080,9 +2080,11 @@ sub process { · 2079 unmodified lines
20802080
20812081 my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g;
20822082
2083+ my $dt_path = $root . "/Documentation/devicetree/bindings/";
2084+ my $vp_file = $dt_path . "vendor-prefixes.txt";
2085+
20832086 foreach my $compat (@compats) {
20842087 my $compat2 = $compat;
2085− my $dt_path = $root . "/Documentation/devicetree/bindings/";
20862088 $compat2 =~ s/\,[a-z]*\-/\,<\.\*>\-/;
20872089 `grep -Erq "$compat|$compat2" $dt_path`;
20882090 if ( $? >> 8 ) {
@@ -2090,14 +2092,12 @@ sub process { · 1 unmodified line
20902092 "DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr);
20912093 }
20922094
2093− my $vendor_path = $dt_path . "vendor-prefixes.txt";
2094− next if (! -f $vendor_path);
20952095 next if $compat !~ /^([a-zA-Z0-9\-]+)\,/;
20962096 my $vendor = $1;
2097− `grep -Eq "$vendor" $vendor_path`;
2097+ `grep -Eq "^$vendor\\b" $vp_file`;
20982098 if ( $? >> 8 ) {
20992099 WARN("UNDOCUMENTED_DT_STRING",
2100− "DT compatible string vendor \"$vendor\" appears un-documented -- check $vendor_path\n" . $herecurr);
2100+ "DT compatible string vendor \"$vendor\" appears un-documented -- check $vp_file\n" . $herecurr);
21012101 }
21022102 }
21032103 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t