[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1905091015440.1480-100000@iolanthe.rowland.org>
Date: Thu, 9 May 2019 10:31:59 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Greg KH <gregkh@...uxfoundation.org>
cc: Jim Lin <jilin@...dia.com>, <mathias.nyman@...el.com>,
<kai.heng.feng@...onical.com>, <drinkcat@...omium.org>,
<keescook@...omium.org>, <nsaenzjulienne@...e.de>,
<jflat@...omium.org>, <malat@...ian.org>,
<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v7 1/1] usb: xhci: Add Clear_TT_Buffer
On Thu, 9 May 2019, Greg KH wrote:
> On Thu, May 09, 2019 at 08:03:15PM +0800, Jim Lin wrote:
> > --- a/include/linux/usb.h
> > +++ b/include/linux/usb.h
> > @@ -625,6 +625,7 @@ struct usb3_lpm_parameters {
> > * parent->hub_delay + wHubDelay + tTPTransmissionDelay (40ns)
> > *
> > * Will be used as wValue for SetIsochDelay requests.
> > + * @devaddr: address on a USB bus, assigned by controller like XHCI
> > *
> > * Notes:
> > * Usbcore drivers should not set usbdev->state directly. Instead use
> > @@ -709,6 +710,7 @@ struct usb_device {
> > unsigned lpm_disable_count;
> >
> > u16 hub_delay;
> > + int devaddr;
>
> Shouldn't this be u32?
In fact the device address is an unsigned 7-bit value. The size of the
variable we store it in doesn't matter much.
BUT! If it's going to be stored in a regular int then it's foolish to
leave a 16-bit gap between it and the preceding field in the structure.
It should be added at some appropriate spot in the structure, not at
the end.
Overall I think this should be broken up into two patches: one to
introduce the new field and one to implement Clear-TT-Buffer for xHCI.
Furthermore, update_devnum() in hub.c should do:
if (udev->devaddr == 0)
udev->devaddr = devnum;
Then the code usb_hub_clear_tt_buffer() can just use devaddr without
needing to check the HCD type.
Alan Stern
Powered by blists - more mailing lists