dev->devnum is set once in usb_alloc_new_device(), set to 0 again later in usb_new_device() and then set back to the original value. This seems unnecessary, just set devnum once right before calling usb_set_address() on the device. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- drivers/usb/core/usb.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index b94f7978a3..ad1d78b8fb 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -301,15 +301,14 @@ static int usb_get_descriptor(struct usb_device *dev, unsigned char type, } /* - * By the time we get here, the device has gotten a new device ID - * and is in the default state. We need to identify the thing and - * get the ball rolling.. + * By the time we get here, the device is in the default state. We need to + * identify the thing and get the ball rolling.. * * Returns 0 for success, != 0 for error. */ int usb_new_device(struct usb_device *dev) { - int addr, err; + int err; int tmp; void *buf; struct usb_device_descriptor *desc; @@ -326,10 +325,6 @@ int usb_new_device(struct usb_device *dev) buf = dma_alloc(USB_BUFSIZ); - /* We still haven't set the Address yet */ - addr = dev->devnum; - dev->devnum = 0; - /* This is a Windows scheme of initialization sequence, with double * reset of the device (Linux uses the same sequence) * Some equipment is said to work only with such init sequence; this @@ -377,7 +372,7 @@ int usb_new_device(struct usb_device *dev) dev->maxpacketsize = PACKET_SIZE_64; break; } - dev->devnum = addr; + dev->devnum = ++dev_index; err = usb_set_address(dev); /* set address */ @@ -500,7 +495,6 @@ struct usb_device *usb_alloc_new_device(void) { struct usb_device *usbdev = xzalloc(sizeof (*usbdev)); - usbdev->devnum = ++dev_index; usbdev->maxchild = 0; usbdev->dev.bus = &usb_bus_type; usbdev->setup_packet = dma_alloc(sizeof(*usbdev->setup_packet)); -- 2.26.0.rc2 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox