From c7d3ec47f9699bb210799593ebb277168259b8c5 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 10 Jul 2014 15:17:50 +0200 Subject: USB: host: hub: only configure hub once We had a single function which configures the hub and scans the ports. Split this up and configure the hub only once and scan the ports during detect() time. This allows to plug in additional devices into a hub while continuing to use the already existing devices. Signed-off-by: Sascha Hauer --- drivers/usb/core/hub.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 689a79c774..39cadb55ff 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -405,6 +405,13 @@ static int usb_hub_configure(struct usb_device *dev) "" : "no "); usb_hub_power_on(hub); + return 0; +} + +static int usb_hub_configure_ports(struct usb_device *dev) +{ + int i; + for (i = 0; i < dev->maxchild; i++) usb_hub_configure_port(dev, i); @@ -416,7 +423,7 @@ static int usb_hub_detect(struct device_d *dev) struct usb_device *usbdev = container_of(dev, struct usb_device, dev); int i; - usb_hub_configure(usbdev); + usb_hub_configure_ports(usbdev); for (i = 0; i < usbdev->maxchild; i++) { if (usbdev->children[i]) -- cgit v1.2.3