LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] checkpatch.pl: Update DT vendor prefix check
@ 2019-05-22 15:12 Rob Herring
  2019-05-22 17:16 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2019-05-22 15:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: devicetree, Joe Perches

In commit 8122de54602e ("dt-bindings: Convert vendor prefixes to
json-schema"), vendor-prefixes.txt has been converted to a DT schema.
Update the checkpatch.pl DT check to extract vendor prefixes from the new
vendor-prefixes.yaml file.

Fixes: 8122de54602e ("dt-bindings: Convert vendor prefixes to json-schema")
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index bb28b178d929..073051a4471b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3027,7 +3027,7 @@ sub process {
 			my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g;
 
 			my $dt_path = $root . "/Documentation/devicetree/bindings/";
-			my $vp_file = $dt_path . "vendor-prefixes.txt";
+			my $vp_file = $dt_path . "vendor-prefixes.yaml";
 
 			foreach my $compat (@compats) {
 				my $compat2 = $compat;
@@ -3042,7 +3042,7 @@ sub process {
 
 				next if $compat !~ /^([a-zA-Z0-9\-]+)\,/;
 				my $vendor = $1;
-				`grep -Eq "^$vendor\\b" $vp_file`;
+				`grep -oE "\\"\\^[a-zA-Z0-9]+" $vp_file | grep -q "$vendor"`;
 				if ( $? >> 8 ) {
 					WARN("UNDOCUMENTED_DT_STRING",
 					     "DT compatible string vendor \"$vendor\" appears un-documented -- check $vp_file\n" . $herecurr);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch.pl: Update DT vendor prefix check
  2019-05-22 15:12 [PATCH] checkpatch.pl: Update DT vendor prefix check Rob Herring
@ 2019-05-22 17:16 ` Joe Perches
  2019-05-22 17:58   ` Rob Herring
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2019-05-22 17:16 UTC (permalink / raw)
  To: Rob Herring, linux-kernel; +Cc: devicetree

On Wed, 2019-05-22 at 10:12 -0500, Rob Herring wrote:
> In commit 8122de54602e ("dt-bindings: Convert vendor prefixes to
> json-schema"), vendor-prefixes.txt has been converted to a DT schema.
> Update the checkpatch.pl DT check to extract vendor prefixes from the new
> vendor-prefixes.yaml file.
> 
> Fixes: 8122de54602e ("dt-bindings: Convert vendor prefixes to json-schema")
> Cc: Joe Perches <joe@perches.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  scripts/checkpatch.pl | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index bb28b178d929..073051a4471b 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3027,7 +3027,7 @@ sub process {
>  			my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g;
>  
>  			my $dt_path = $root . "/Documentation/devicetree/bindings/";
> -			my $vp_file = $dt_path . "vendor-prefixes.txt";
> +			my $vp_file = $dt_path . "vendor-prefixes.yaml";
>  
>  			foreach my $compat (@compats) {
>  				my $compat2 = $compat;
> @@ -3042,7 +3042,7 @@ sub process {
>  
>  				next if $compat !~ /^([a-zA-Z0-9\-]+)\,/;
>  				my $vendor = $1;
> -				`grep -Eq "^$vendor\\b" $vp_file`;
> +				`grep -oE "\\"\\^[a-zA-Z0-9]+" $vp_file | grep -q "$vendor"`;

I think this does't work well as it loses the -
in various vendor prefixes:

  "^active-semi,.*":
  "^asahi-kasei,.*":
  "^ebs-systart,.*":
  "^inside-secure,.*":
  "^multi-inno,.*":
  "^netron-dy,.*":
  "^si-en,.*":
  "^si-linux,.*":
  "^tbs-biometrics,.*":
  "^u-blox,.*":
  "^x-powers,.*":

Perhaps the grep should be something like: (untested)

	`grep -Eq "\\"\\^\Q$vendor\E,\\.\\*\\":" $vp_file`;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch.pl: Update DT vendor prefix check
  2019-05-22 17:16 ` Joe Perches
@ 2019-05-22 17:58   ` Rob Herring
  0 siblings, 0 replies; 3+ messages in thread
From: Rob Herring @ 2019-05-22 17:58 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel, devicetree

On Wed, May 22, 2019 at 12:16 PM Joe Perches <joe@perches.com> wrote:
>
> On Wed, 2019-05-22 at 10:12 -0500, Rob Herring wrote:
> > In commit 8122de54602e ("dt-bindings: Convert vendor prefixes to
> > json-schema"), vendor-prefixes.txt has been converted to a DT schema.
> > Update the checkpatch.pl DT check to extract vendor prefixes from the new
> > vendor-prefixes.yaml file.
> >
> > Fixes: 8122de54602e ("dt-bindings: Convert vendor prefixes to json-schema")
> > Cc: Joe Perches <joe@perches.com>
> > Signed-off-by: Rob Herring <robh@kernel.org>
> > ---
> >  scripts/checkpatch.pl | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index bb28b178d929..073051a4471b 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -3027,7 +3027,7 @@ sub process {
> >                       my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g;
> >
> >                       my $dt_path = $root . "/Documentation/devicetree/bindings/";
> > -                     my $vp_file = $dt_path . "vendor-prefixes.txt";
> > +                     my $vp_file = $dt_path . "vendor-prefixes.yaml";
> >
> >                       foreach my $compat (@compats) {
> >                               my $compat2 = $compat;
> > @@ -3042,7 +3042,7 @@ sub process {
> >
> >                               next if $compat !~ /^([a-zA-Z0-9\-]+)\,/;
> >                               my $vendor = $1;
> > -                             `grep -Eq "^$vendor\\b" $vp_file`;
> > +                             `grep -oE "\\"\\^[a-zA-Z0-9]+" $vp_file | grep -q "$vendor"`;
>
> I think this does't work well as it loses the -
> in various vendor prefixes:
>
>   "^active-semi,.*":
>   "^asahi-kasei,.*":
>   "^ebs-systart,.*":
>   "^inside-secure,.*":
>   "^multi-inno,.*":
>   "^netron-dy,.*":
>   "^si-en,.*":
>   "^si-linux,.*":
>   "^tbs-biometrics,.*":
>   "^u-blox,.*":
>   "^x-powers,.*":

Ah, indeed.

> Perhaps the grep should be something like: (untested)
>
>         `grep -Eq "\\"\\^\Q$vendor\E,\\.\\*\\":" $vp_file`;

That works. Thanks.

Rob

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-22 17:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 15:12 [PATCH] checkpatch.pl: Update DT vendor prefix check Rob Herring
2019-05-22 17:16 ` Joe Perches
2019-05-22 17:58   ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).