# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.604   -> 1.604.1.1
#	drivers/usb/host/ohci-hcd.c	1.17    -> 1.18   
#	drivers/usb/host/ohci-dbg.c	1.6     -> 1.7    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/06/21	david-b@pacbell.net	1.604.1.1
# [PATCH] ohci-hcd cardbus unplug
# 
# 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.
# --------------------------------------------
#
diff -Nru a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
--- a/drivers/usb/host/ohci-dbg.c	Fri Jul  5 14:51:29 2002
+++ b/drivers/usb/host/ohci-dbg.c	Fri Jul  5 14:51:29 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) {
diff -Nru a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
--- a/drivers/usb/host/ohci-hcd.c	Fri Jul  5 14:51:29 2002
+++ b/drivers/usb/host/ohci-hcd.c	Fri Jul  5 14:51:29 2002
@@ -502,10 +502,18 @@
 	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));
 
