ChangeSet 1.1673.8.11, 2004/03/25 16:06:44-08:00, david-b@pacbell.net

[PATCH] USB: fix osdl bugid 2006 (timer init and fault paths)

Need to initialize timers a bit earlier to handle
certain initialization faults.


OSDL bug 2006

Need to initialize some timers a bit earlier to clean up safely
after very early init HCD failures.

Those early init faults were needlessly mysterious since they
didn't emit diagnostics except at HCD discretion.


 drivers/usb/core/hcd-pci.c  |    5 ++++-
 drivers/usb/host/ehci-hcd.c |    8 ++++----
 2 files changed, 8 insertions(+), 5 deletions(-)


diff -Nru a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
--- a/drivers/usb/core/hcd-pci.c	Wed Apr 14 14:39:31 2004
+++ b/drivers/usb/core/hcd-pci.c	Wed Apr 14 14:39:31 2004
@@ -196,13 +196,16 @@
 	hcd->self.op = &usb_hcd_operations;
 	hcd->self.hcpriv = (void *) hcd;
 	hcd->self.release = &hcd_pci_release;
+	init_timer (&hcd->rh_timer);
 
 	INIT_LIST_HEAD (&hcd->dev_list);
 
 	usb_register_bus (&hcd->self);
 
-	if ((retval = driver->start (hcd)) < 0)
+	if ((retval = driver->start (hcd)) < 0) {
+		dev_err (hcd->self.controller, "init error %d\n", retval);
 		usb_hcd_pci_remove (dev);
+	}
 
 	return retval;
 } 
diff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
--- a/drivers/usb/host/ehci-hcd.c	Wed Apr 14 14:39:31 2004
+++ b/drivers/usb/host/ehci-hcd.c	Wed Apr 14 14:39:31 2004
@@ -374,6 +374,10 @@
 	u32			hcc_params;
 	u8                      tempbyte;
 
+	init_timer (&ehci->watchdog);
+	ehci->watchdog.function = ehci_watchdog;
+	ehci->watchdog.data = (unsigned long) ehci;
+
 	/*
 	 * hw default: 1K periodic list heads, one per frame.
 	 * periodic_size can shrink by USBCMD update if hcc_params allows.
@@ -467,10 +471,6 @@
 	dbg_cmd (ehci, "init", temp);
 
 	/* set async sleep time = 10 us ... ? */
-
-	init_timer (&ehci->watchdog);
-	ehci->watchdog.function = ehci_watchdog;
-	ehci->watchdog.data = (unsigned long) ehci;
 
 	/* wire up the root hub */
 	bus = hcd_to_bus (hcd);