[PATCH 09/12] USB: host: hub: only configure hub once

Sascha Hauer s.hauer at pengutronix.de
Sat Jul 19 02:16:04 PDT 2014


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 <s.hauer at pengutronix.de>
---
 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 689a79c..39cadb5 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])
-- 
2.0.1




More information about the barebox mailing list