This is the 2.5 version of that 2.4 patch I sent recently,
which makes the OHCI driver behave usably on at least
some cardbus systems when the card is just ejected without
a clean shutdown.

Please merge to Linus' latest.

- Dave
--- ./drivers/usb-dist/host/ohci-hcd.c  Tue Jun 18 18:28:12 2002
+++ ./drivers/usb/host/ohci-hcd.c       Tue Jun 18 18:40:36 2002
@@ -502,11 +502,19 @@
        if ((ohci->hcca->done_head != 0)
                        && ! (le32_to_cpup (&ohci->hcca->done_head) & 0x01)) {
                ints =  OHCI_INTR_WDH;
-       } else if ((ints = (readl (&regs->intrstatus)
-                       & readl (&regs->intrenable))) == 0) {
+
+       /* cardbus/... hardware gone before remove() */
+       } else if ((ints = readl (&regs->intrstatus)) == ~(u32)0) {
+               ohci->disabled++;
+               err ("%s device removed!", hcd->self.bus_name);
+               return;
+
+       /* interrupt for some other device? */
+       } else if ((ints &= readl (&regs->intrenable)) == 0) {
                return;
        } 
 
+
        // dbg ("Interrupt: %x frame: %x", ints, le16_to_cpu (ohci->hcca->frame_no));
 
        if (ints & OHCI_INTR_UE) {
--- ./drivers/usb-dist/host/ohci-dbg.c  Tue Jun 18 18:28:12 2002
+++ ./drivers/usb/host/ohci-dbg.c       Tue Jun 18 18:29:41 2002
@@ -190,6 +190,8 @@
        __u32                   temp, ndp, i;
 
        temp = roothub_a (controller);
+       if (temp == ~(u32)0)
+               return;
        ndp = (temp & RH_A_NDP);
 
        if (verbose) {

Reply via email to