ChangeSet 1.1119.1.3, 2003/08/06 15:50:39-07:00, david-b@pacbell.net

[PATCH] USB: ohci-hcd, minor d3cold resume fix

The ohci d3cold resume path kept re-creating the sysfs files,
and that seemed eventually to cause an oops.  This patch
only creates them on first initialization, not re-init;
and includes some minor debug message tweaks.


 drivers/usb/host/ohci-hcd.c    |    4 +---
 drivers/usb/host/ohci-pci.c    |   11 +++++------
 drivers/usb/host/ohci-sa1111.c |    1 +
 3 files changed, 7 insertions(+), 9 deletions(-)


diff -Nru a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
--- a/drivers/usb/host/ohci-hcd.c	Fri Aug  8 17:06:17 2003
+++ b/drivers/usb/host/ohci-hcd.c	Fri Aug  8 17:06:17 2003
@@ -412,8 +412,7 @@
 	/* Disable HC interrupts */
 	writel (OHCI_INTR_MIE, &ohci->regs->intrdisable);
 
-	ohci_dbg (ohci, "USB HC reset_hc %s: ctrl = 0x%x ;\n",
-		hcd_to_bus (&ohci->hcd)->bus_name,
+	ohci_dbg (ohci, "reset, control = 0x%x\n",
 		readl (&ohci->regs->control));
 
   	/* Reset USB (needed by some controllers); RemoteWakeupConnected
@@ -548,7 +547,6 @@
 		return -ENODEV;
 	}
 
-	create_debug_files (ohci);
 	return 0;
 }
 
diff -Nru a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
--- a/drivers/usb/host/ohci-pci.c	Fri Aug  8 17:06:17 2003
+++ b/drivers/usb/host/ohci-pci.c	Fri Aug  8 17:06:17 2003
@@ -101,6 +101,7 @@
 		ohci_stop (hcd);
 		return -EBUSY;
 	}
+	create_debug_files (ohci);
 
 #ifdef	DEBUG
 	ohci_dump (ohci, 1);
@@ -115,6 +116,7 @@
 	struct ohci_hcd		*ohci = hcd_to_ohci (hcd);
 	unsigned long		flags;
 	u16			cmd;
+	u32			tmp;
 
 	if ((ohci->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_OPER) {
 		ohci_dbg (ohci, "can't suspend (state is %s)\n",
@@ -156,15 +158,12 @@
 	(void) readl (&ohci->regs->control);
 	mdelay (500); /* No schedule here ! */
 
-	switch (readl (&ohci->regs->control) & OHCI_CTRL_HCFS) {
+	tmp = readl (&ohci->regs->control) | OHCI_CTRL_HCFS;
+	switch (tmp) {
 		case OHCI_USB_RESET:
-			ohci_dbg (ohci, "suspend->reset ?\n");
-			break;
 		case OHCI_USB_RESUME:
-			ohci_dbg (ohci, "suspend->resume ?\n");
-			break;
 		case OHCI_USB_OPER:
-			ohci_dbg (ohci, "suspend->operational ?\n");
+			ohci_err (ohci, "can't suspend; hcfs %d\n", tmp);
 			break;
 		case OHCI_USB_SUSPEND:
 			ohci_dbg (ohci, "suspended\n");
diff -Nru a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c
--- a/drivers/usb/host/ohci-sa1111.c	Fri Aug  8 17:06:17 2003
+++ b/drivers/usb/host/ohci-sa1111.c	Fri Aug  8 17:06:17 2003
@@ -296,6 +296,7 @@
 		ohci_stop (hcd);
 		return -EBUSY;
 	}
+	create_debug_files (ohci);
 
 #ifdef	DEBUG
 	ohci_dump (ohci, 1);
