ChangeSet 1.1722.97.73, 2004/06/14 10:35:58-07:00, stern@rowland.harvard.edu

[PATCH] USB: Fix bug in TT initialization introduced by earlier

This patch repairs a bug introduced by an earlier patch: The TT
initialization code was moved to _after_ the TT's first use.  The patch
simply puts the code back the way it used to be.



Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/usb/core/hub.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)


diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c	Fri Jun 18 10:53:52 2004
+++ b/drivers/usb/core/hub.c	Fri Jun 18 10:53:52 2004
@@ -1405,6 +1405,19 @@
 			default: 		speed = "?";	break;
 			}; speed;}),
 			udev->devnum);
+
+	/* Set up TT records, if needed  */
+	if (hdev->tt) {
+		udev->tt = hdev->tt;
+		udev->ttport = hdev->ttport;
+	} else if (udev->speed != USB_SPEED_HIGH
+			&& hdev->speed == USB_SPEED_HIGH) {
+		struct usb_hub *hub;
+
+		hub = usb_get_intfdata(hdev->actconfig->interface[0]);
+		udev->tt = &hub->tt;
+		udev->ttport = port + 1;
+	}
  
 	/* Why interleave GET_DESCRIPTOR and SET_ADDRESS this way?
 	 * Because device hardware and firmware is sometimes buggy in
@@ -1614,16 +1627,6 @@
 		status = hub_port_init(hdev, udev, port);
 		if (status < 0)
 			goto loop;
-
-		/* Set up TT records, if needed  */
-		if (hdev->tt) {
-			udev->tt = hdev->tt;
-			udev->ttport = hdev->ttport;
-		} else if (udev->speed != USB_SPEED_HIGH
-				&& hdev->speed == USB_SPEED_HIGH) {
-			udev->tt = &hub->tt;
-			udev->ttport = port + 1;
-		}
 
 		/* consecutive bus-powered hubs aren't reliable; they can
 		 * violate the voltage drop budget.  if the new child has
