summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-05-06 21:36:13 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-05-06 21:36:13 +0200
commit3975737a7d48b3c767f60be994d55884321d45f9 (patch)
tree8be2f56c4978420e6e4c4b3292e18c61b07a926e /scripts
parent10fb7853084356ef3c6b40ddf21dfb05dbd15691 (diff)
parent6d4afd96fc94a3f2d256ef4e8d7c9687a145a701 (diff)
downloadbarebox-3975737a7d48b3c767f60be994d55884321d45f9.tar.gz
barebox-3975737a7d48b3c767f60be994d55884321d45f9.tar.xz
Merge branch 'for-next/misc'
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl35
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a40d32cba7..8d96434650 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1466,6 +1466,41 @@ sub process {
#print "is_end<$is_end> length<$length>\n";
}
+# check for DT compatible documentation
+ if (defined $root &&
+ (($realfile =~ /\.dtsi?$/ && $line =~ /^\+\s*compatible\s*=\s*\"/) ||
+ ($realfile =~ /\.[ch]$/ && $line =~ /^\+.*\.compatible\s*=\s*\"/))) {
+
+ my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g;
+
+ # linux device tree files
+ my $dt_path = $root . "/dts/Bindings/";
+ my $vp_file = $dt_path . "vendor-prefixes.txt";
+
+ # barebox-specific bindings
+ $dt_path = $dt_path . " " . $root . "/Documentation/devicetree/bindings/";
+
+ foreach my $compat (@compats) {
+ my $compat2 = $compat;
+ $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(
+ "DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr);
+ }
+
+ next if $compat !~ /^([a-zA-Z0-9\-]+)\,/;
+ my $vendor = $1;
+ `grep -Eq "^$vendor\\b" $vp_file`;
+ if ( $? >> 8 ) {
+ WARN(
+ "DT compatible string vendor \"$vendor\" appears un-documented -- check $vp_file\n" . $herecurr);
+ }
+ }
+ }
+
# check we are in a valid source file if not then ignore this hunk
next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);