Re: [PATCH v7 1/1] usb: xhci: Add Clear_TT_Buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux