diff options
author | Rob Herring <robh@kernel.org> | 2014-01-23 18:54:51 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-23 19:36:58 -0500 |
commit | bff5da4335256513497cc8c79f9a9d1665e09864 (patch) | |
tree | 4cd51486058e7cdd0ec77073f729da849a150da7 /scripts | |
parent | 109d8cb2002dcb0fff04ff1afe8f1cec66bbdad9 (diff) |
checkpatch: add DT compatible string documentation checks
This adds a simple check that any compatible strings in DeviceTree dts
files are present in Documentation/devicetree/bindings. Vendor prefixes
are also checked for existing in vendor-prefixes.txt These should be
temporary checks until we have more sophisticated binding schema
checking.
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d89e4299c19d..05c99c0b7e6c 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -2040,6 +2040,33 @@ sub process { | |||
2040 | "Use of $flag is deprecated, please use \`$replacement->{$flag} instead.\n" . $herecurr) if ($replacement->{$flag}); | 2040 | "Use of $flag is deprecated, please use \`$replacement->{$flag} instead.\n" . $herecurr) if ($replacement->{$flag}); |
2041 | } | 2041 | } |
2042 | 2042 | ||
2043 | # check for DT compatible documentation | ||
2044 | if (defined $root && $realfile =~ /\.dts/ && | ||
2045 | $rawline =~ /^\+\s*compatible\s*=/) { | ||
2046 | my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g; | ||
2047 | |||
2048 | foreach my $compat (@compats) { | ||
2049 | my $compat2 = $compat; | ||
2050 | my $dt_path = $root . "/Documentation/devicetree/bindings/"; | ||
2051 | $compat2 =~ s/\,[a-z]*\-/\,<\.\*>\-/; | ||
2052 | `grep -Erq "$compat|$compat2" $dt_path`; | ||
2053 | if ( $? >> 8 ) { | ||
2054 | WARN("UNDOCUMENTED_DT_STRING", | ||
2055 | "DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr); | ||
2056 | } | ||
2057 | |||
2058 | my $vendor = $compat; | ||
2059 | my $vendor_path = $dt_path . "vendor-prefixes.txt"; | ||
2060 | next if (! -f $vendor_path); | ||
2061 | $vendor =~ s/^([a-zA-Z0-9]+)\,.*/$1/; | ||
2062 | `grep -Eq "$vendor" $vendor_path`; | ||
2063 | if ( $? >> 8 ) { | ||
2064 | WARN("UNDOCUMENTED_DT_STRING", | ||
2065 | "DT compatible string vendor \"$vendor\" appears un-documented -- check $vendor_path\n" . $herecurr); | ||
2066 | } | ||
2067 | } | ||
2068 | } | ||
2069 | |||
2043 | # check we are in a valid source file if not then ignore this hunk | 2070 | # check we are in a valid source file if not then ignore this hunk |
2044 | next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/); | 2071 | next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/); |
2045 | 2072 | ||