* [PATCH] checkpatch: don't complain about "undocumented" USB VID
@ 2019-02-22 22:55 Brian Norris
2019-02-23 0:52 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Brian Norris @ 2019-02-22 22:55 UTC (permalink / raw)
To: Andy Whitcroft, Joe Perches; +Cc: linux-kernel, devicetree, Brian Norris
Documentation/devicetree/bindings/usb/usb-device.txt describes the
'usbVID,...' compatible format, where VID is hexadecimal, with leading
zeroes suppressed. Allow it here without complaining.
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
scripts/checkpatch.pl | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b737ca9d7204..124c6fc116b3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3012,6 +3012,8 @@ sub process {
}
next if $compat !~ /^([a-zA-Z0-9\-]+)\,/;
+ # USB VIDs don't need special vendor prefix documentation.
+ next if $compat =~ /^usb[1-9a-f][0-9a-f]{0,3},/;
my $vendor = $1;
`grep -Eq "^$vendor\\b" $vp_file`;
if ( $? >> 8 ) {
--
2.21.0.rc0.258.g878e2cd30e-goog
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] checkpatch: don't complain about "undocumented" USB VID
2019-02-22 22:55 [PATCH] checkpatch: don't complain about "undocumented" USB VID Brian Norris
@ 2019-02-23 0:52 ` Joe Perches
2019-02-23 1:00 ` Brian Norris
0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2019-02-23 0:52 UTC (permalink / raw)
To: Brian Norris, Andy Whitcroft; +Cc: linux-kernel, devicetree
On Fri, 2019-02-22 at 14:55 -0800, Brian Norris wrote:
> Documentation/devicetree/bindings/usb/usb-device.txt describes the
> 'usbVID,...' compatible format, where VID is hexadecimal, with leading
> zeroes suppressed. Allow it here without complaining.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3012,6 +3012,8 @@ sub process {
> }
>
> next if $compat !~ /^([a-zA-Z0-9\-]+)\,/;
> + # USB VIDs don't need special vendor prefix documentation.
> + next if $compat =~ /^usb[1-9a-f][0-9a-f]{0,3},/;
Maybe check the PID too?
next if $compat =~ /^usb[1-9a-f][0-9a-f]{0,3},[1-9a-f][0-9a-f]{0,3}\b/;
Maybe add a test for uses of the leading 0?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] checkpatch: don't complain about "undocumented" USB VID
2019-02-23 0:52 ` Joe Perches
@ 2019-02-23 1:00 ` Brian Norris
0 siblings, 0 replies; 3+ messages in thread
From: Brian Norris @ 2019-02-23 1:00 UTC (permalink / raw)
To: Joe Perches; +Cc: Andy Whitcroft, Linux Kernel, devicetree
On Fri, Feb 22, 2019 at 4:52 PM Joe Perches <joe@perches.com> wrote:
>
> On Fri, 2019-02-22 at 14:55 -0800, Brian Norris wrote:
> > Documentation/devicetree/bindings/usb/usb-device.txt describes the
> > 'usbVID,...' compatible format, where VID is hexadecimal, with leading
> > zeroes suppressed. Allow it here without complaining.
> []
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > @@ -3012,6 +3012,8 @@ sub process {
> > }
> >
> > next if $compat !~ /^([a-zA-Z0-9\-]+)\,/;
> > + # USB VIDs don't need special vendor prefix documentation.
> > + next if $compat =~ /^usb[1-9a-f][0-9a-f]{0,3},/;
>
> Maybe check the PID too?
>
> next if $compat =~ /^usb[1-9a-f][0-9a-f]{0,3},[1-9a-f][0-9a-f]{0,3}\b/;
Ah, good point. I shouldn't be allowing, e.g.,
"usb123,something-that's-not-a-PID".
> Maybe add a test for uses of the leading 0?
I suppose that'd be good too. Would help catch problems with the PID,
at least. (VID problems would fall into the "invalid vendor prefix"
check that's already present.)
Thanks,
Brian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-23 1:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-22 22:55 [PATCH] checkpatch: don't complain about "undocumented" USB VID Brian Norris
2019-02-23 0:52 ` Joe Perches
2019-02-23 1:00 ` Brian Norris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®