lkml.org 
[lkml]   [2019]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2019-05-09 16:32    [W:0.040 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site