checkpatch.pl: Update DT vendor prefix check
PATCH 1/1 checkpatch.pl: Update DT vendor prefix check
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.
--- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +2 -2
@@ -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);
Signature · 1 line
2.20.1
Joe Perches
maintainerQuoted 26 lines · Rob Herring
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 newvendor-prefixes.yamlfile.Fixes 8122de54602e ("dt-bindings: Convert vendor prefixes to json-schema")Cc Joe Perches <[email protected]>Signed-off-by Rob Herring <[email protected]>--- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)scripts/checkpatch.pl +1
-1@@ -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;
scripts/checkpatch.pl sub process { · line 3045
Quoted 5 lines
scripts/checkpatch.pl +1
-1@@ -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`;
Quoted 37 lines · Joe Perches
Quoted 26 lines · Rob Herring
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 newvendor-prefixes.yamlfile.Fixes 8122de54602e ("dt-bindings: Convert vendor prefixes to json-schema")Cc Joe Perches <[email protected]>Signed-off-by Rob Herring <[email protected]>--- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)scripts/checkpatch.pl +1
-1@@ -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;scripts/checkpatch.pl sub process { · line 3045
Quoted 5 lines
scripts/checkpatch.pl +1
-1@@ -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:
Quoted 11 lines
"^active-semi,.*":
"^asahi-kasei,.*":
"^ebs-systart,.*":
"^inside-secure,.*":
"^multi-inno,.*":
"^netron-dy,.*":
"^si-en,.*":
"^si-linux,.*":
"^tbs-biometrics,.*":
"^u-blox,.*":
"^x-powers,.*":
Ah, indeed.
Quoted 3 lines
Perhaps the grep should be something like: (untested)
`grep -Eq "\\"\\^\Q$vendor\E,\\.\\*\\":" $vp_file`;
That works. Thanks.
Rob