# 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.379   -> 1.380  
#	  drivers/usb/uhci.c	1.25    -> 1.26   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/02/20	johannes@erdfelt.com	1.380
# [PATCH] uhci.c, interrupt unlink in completion
# 
# This patch fixes a bug where an interrupt URB is unlinked in the drivers
# completion handler and we'll try to resubmit it anyway.
# --------------------------------------------
#
diff -Nru a/drivers/usb/uhci.c b/drivers/usb/uhci.c
--- a/drivers/usb/uhci.c	Wed Feb 20 16:55:47 2002
+++ b/drivers/usb/uhci.c	Wed Feb 20 16:55:47 2002
@@ -2263,7 +2263,7 @@
 	killed = (urb->status == -ENOENT || urb->status == -ECONNABORTED ||
 			urb->status == -ECONNRESET);
 	resubmit_interrupt = (usb_pipetype(urb->pipe) == PIPE_INTERRUPT &&
-			urb->interval && !killed);
+			urb->interval);
 
 	nurb = urb->next;
 	if (nurb && !killed) {
@@ -2289,7 +2289,7 @@
 	}
 
 	status = urbp->status;
-	if (!resubmit_interrupt)
+	if (!resubmit_interrupt || killed)
 		/* We don't need urb_priv anymore */
 		uhci_destroy_urb_priv(urb);
 
@@ -2306,10 +2306,17 @@
 			sizeof(struct usb_ctrlrequest), PCI_DMA_TODEVICE);
 
 	urb->dev = NULL;
-	if (urb->complete)
+	if (urb->complete) {
 		urb->complete(urb);
 
-	if (resubmit_interrupt) {
+		/* Recheck the status. The completion handler may have */
+		/*  unlinked the resubmitting interrupt URB */
+		killed = (urb->status == -ENOENT ||
+			  urb->status == -ECONNABORTED ||
+			  urb->status == -ECONNRESET);
+	}
+
+	if (resubmit_interrupt && !killed) {
 		urb->dev = dev;
 		uhci_reset_interrupt(urb);
 	} else {
