From: Antony Pavlov <antonynpavlov@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] checkpatch: add DT compatible string documentation checks
Date: Tue, 28 Apr 2015 10:41:28 +0300 [thread overview]
Message-ID: <20150428104128.cccc96d0de0357315b90caf6@gmail.com> (raw)
In-Reply-To: <1429735158-4250-1-git-send-email-antonynpavlov@gmail.com>
On Wed, 22 Apr 2015 23:39:18 +0300
Antony Pavlov <antonynpavlov@gmail.com> wrote:
ping
> This adds a simple check that any compatible strings in DeviceTree dts
> files are present in Documentation/devicetree/bindings and
> in dts/Bindings/.
>
> Vendor prefixes are also checked for existing in vendor-prefixes.txt.
>
> This code is based on linux v4.0-rc6 checkpatch.pl dt-checking code by
> Rob Herring & Florian Vaussard:
>
> Rob Herring (2):
> checkpatch: add DT compatible string documentation checks
> checkpatch: fix wildcard DT compatible string checking
>
> Florian Vaussard (3):
> checkpatch: fix spurious vendor compatible warnings
> checkpatch: check compatible strings in .c and .h too
> checkpatch: improve the compatible vendor match
>
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Florian Vaussard <florian.vaussard@epfl.ch>
> ---
> scripts/checkpatch.pl | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index a40d32c..8d96434 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)$/);
>
> --
> 2.1.4
>
--
--
Best regards,
Antony Pavlov
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-04-28 7:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 20:39 Antony Pavlov
2015-04-28 7:41 ` Antony Pavlov [this message]
2015-04-28 8:34 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150428104128.cccc96d0de0357315b90caf6@gmail.com \
--to=antonynpavlov@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox