diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-09-20 17:03:52 +0200 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2014-11-04 06:03:59 +0100 |
commit | f7b9baf75596cca891e0a5da85a45c799131404e (patch) | |
tree | 14c32999e2fbed9114050568b492907fc742d7fd | |
parent | 46b7b2e8025770fb29f7810c2d7d15a6650b9643 (diff) | |
download | u-boot-imx-f7b9baf75596cca891e0a5da85a45c799131404e.zip u-boot-imx-f7b9baf75596cca891e0a5da85a45c799131404e.tar.gz u-boot-imx-f7b9baf75596cca891e0a5da85a45c799131404e.tar.bz2 |
usb: Remove unnecessary portnr lookup from usb_new_device
If the device has a parent, it is instantiated from usb_hub_port_connect_change
and the portnr is right there in dev->portnr, so there is no need for this
whole dance to look it up.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | common/usb.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/common/usb.c b/common/usb.c index bd0f8d5..7d33a0f 100644 --- a/common/usb.c +++ b/common/usb.c @@ -927,7 +927,6 @@ int usb_new_device(struct usb_device *dev) * thread_id=5729457&forum_id=5398 */ __maybe_unused struct usb_device_descriptor *desc; - int port = -1; struct usb_device *parent = dev->parent; unsigned short portstatus; @@ -965,24 +964,10 @@ int usb_new_device(struct usb_device *dev) #endif if (parent) { - int j; - - /* find the port number we're at */ - for (j = 0; j < parent->maxchild; j++) { - if (parent->children[j] == dev) { - port = j; - break; - } - } - if (port < 0) { - printf("usb_new_device:cannot locate device's port.\n"); - return 1; - } - /* reset the port for the second time */ - err = hub_port_reset(dev->parent, port, &portstatus); + err = hub_port_reset(dev->parent, dev->portnr - 1, &portstatus); if (err < 0) { - printf("\n Couldn't reset port %i\n", port); + printf("\n Couldn't reset port %i\n", dev->portnr); return 1; } } |