OHCI problems with suspend/resume

From: Pavel Machek (pavel@ucw.cz)
Date: Wed Jul 23 2003 - 17:08:06 EST


Hi!

In 2.6.0-test1, OHCI is non-functional after first suspend/resume, and
kills machine during secon suspend/resume cycle.

What happens is that ohci_irq gets ohci->hcca == NULL, and kills
machine. Why is ohci->hcca == NULL? ohci_stop was called from
hcd_panic() and freed ohci->hcca.

I believe that we should

1) not free ohci->hcca so that system has better chance surviving
hcd_panic()

and

2) inform user when hcd panics.

This patch does both, please apply,

[Okay, you probably want to kill the ifdefs, and kill the code,
leaving just a comment...]
                                                                Pavel

--- /usr/src/tmp/linux/drivers/usb/core/hcd.c 2003-07-06 20:07:49.000000000 +0200
+++ /usr/src/linux/drivers/usb/core/hcd.c 2003-07-23 23:32:55.000000000 +0200
@@ -1486,6 +1486,7 @@
 static void hcd_panic (void *_hcd)
 {
         struct usb_hcd *hcd = _hcd;
+ printk(KERN_CRIT "Host controller panicked\n");
         hcd->driver->stop (hcd);
 }
 
--- /usr/src/tmp/linux/drivers/usb/host/ohci-hcd.c 2003-05-27 13:43:39.000000000 +0200
+++ /usr/src/linux/drivers/usb/host/ohci-hcd.c 2003-07-23 23:31:46.000000000 +0200
@@ -627,12 +632,18 @@
         
         remove_debug_files (ohci);
         ohci_mem_cleanup (ohci);
+#if 0
+ /* Freeing hcca at this point is bad idea, because ohci_irq
+ can't cope with ohci->hcca being NULL, and therefore will
+ crash the machine after hcd_panic()
+ */
         if (ohci->hcca) {
                 pci_free_consistent (ohci->hcd.pdev, sizeof *ohci->hcca,
                                         ohci->hcca, ohci->hcca_dma);
                 ohci->hcca = NULL;
                 ohci->hcca_dma = 0;
         }
+#endif
 }
 
 /*-------------------------------------------------------------------------*/

-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jul 23 2003 - 22:00:51 EST