diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-07-10 15:10:09 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-07-18 14:50:21 +0200 |
commit | 81a2205228646a9abf3548c197d415ef9167a1c5 (patch) | |
tree | 7827f7fe09304bbbe2bd36afd394c9d66309f646 /drivers/usb/core | |
parent | 99b79e4a456b6bfee07b385cca722c5da925f28b (diff) | |
download | barebox-81a2205228646a9abf3548c197d415ef9167a1c5.tar.gz barebox-81a2205228646a9abf3548c197d415ef9167a1c5.tar.xz |
USB: host: drop force rescan
We can now detect changes in the USB device hierarchy properly, so
the 'force' option to the usb command is no longer necessary. We just
scan the busses each time the usb command is called.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/usb.c | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index faf509ec9d..fdf9d94a52 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -492,50 +492,35 @@ struct usb_device *usb_alloc_new_device(void) return usbdev; } -int usb_host_detect(struct usb_host *host, int force) +int usb_host_detect(struct usb_host *host) { - struct usb_device *dev, *tmp; int ret; - if (host->scanned && !force) - return -EBUSY; - - list_for_each_entry_safe(dev, tmp, &usb_device_list, list) { - if (dev->host != host) - continue; + if (!host->root_dev) { + ret = host->init(host); + if (ret) + return ret; - list_del(&dev->list); - unregister_device(&dev->dev); - free(dev->hub); - dma_free(dev->setup_packet); - dma_free(dev->descriptor); - free(dev); + host->root_dev = usb_alloc_new_device(); + host->root_dev->dev.parent = host->hw_dev; + host->root_dev->host = host; + usb_new_device(host->root_dev); } - ret = host->init(host); - if (ret) - return ret; - - dev = usb_alloc_new_device(); - dev->dev.parent = host->hw_dev; - dev->host = host; - usb_new_device(dev); - - host->scanned = 1; + device_detect(&host->root_dev->dev); return 0; } -void usb_rescan(int force) +void usb_rescan(void) { struct usb_host *host; int ret; pr_info("USB: scanning bus for devices...\n"); - dev_index = 0; list_for_each_entry(host, &host_list, list) { - ret = usb_host_detect(host, force); + ret = usb_host_detect(host); if (ret) continue; } |