ChangeSet 1.808.2.14, 2002/10/28 11:45:45-08:00, greg@kroah.com

USB: fix the usb serial drivers due to interrupt urb no automatic resubmission change to the usb core.


diff -Nru a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
--- a/drivers/usb/serial/belkin_sa.c	Mon Oct 28 13:53:49 2002
+++ b/drivers/usb/serial/belkin_sa.c	Mon Oct 28 13:53:49 2002
@@ -258,11 +258,23 @@
 	struct belkin_sa_private *priv;
 	struct usb_serial *serial;
 	unsigned char *data = urb->transfer_buffer;
+	int retval;
 
-	/* the urb might have been killed. */
-	if (urb->status)
+	switch (urb->status) {
+	case 0:
+		/* success */
+		break;
+	case -ECONNRESET:
+	case -ENOENT:
+	case -ESHUTDOWN:
+		/* this urb is terminated, clean up */
+		dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);
 		return;
-	
+	default:
+		dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
+		goto exit;
+	}
+
 	if (port_paranoia_check (port, __FUNCTION__)) return;
 
 	serial = port->serial;
@@ -321,8 +333,11 @@
 		}
 	}
 #endif
-
-	/* INT urbs are automatically re-submitted */
+exit:
+	retval = usb_submit_urb (urb, GFP_ATOMIC);
+	if (retval)
+		err ("%s - usb_submit_urb failed with result %d",
+		     __FUNCTION__, retval);
 }
 
 static void belkin_sa_set_termios (struct usb_serial_port *port, struct termios *old_termios)
diff -Nru a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
--- a/drivers/usb/serial/io_edgeport.c	Mon Oct 28 13:53:49 2002
+++ b/drivers/usb/serial/io_edgeport.c	Mon Oct 28 13:53:49 2002
@@ -772,9 +772,19 @@
 		return;
 	}
 
-	if (urb->status) {
-		dbg("%s - nonzero control read status received: %d", __FUNCTION__, urb->status);
+	switch (urb->status) {
+	case 0:
+		/* success */
+		break;
+	case -ECONNRESET:
+	case -ENOENT:
+	case -ESHUTDOWN:
+		/* this urb is terminated, clean up */
+		dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);
 		return;
+	default:
+		dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
+		goto exit;
 	}
 
 	// process this interrupt-read even if there are no ports open
@@ -826,6 +836,12 @@
 			++portNumber;
 		}
 	}
+
+exit:
+	result = usb_submit_urb (urb, GFP_ATOMIC);
+	if (result) {
+		err("%s - Error %d submitting control urb", __FUNCTION__, result);
+	}
 }
 
 
@@ -1020,21 +1036,22 @@
 		edge_serial->bulk_out_endpoint = port0->bulk_out_endpointAddress;
 	
 		/* set up our interrupt urb */
-		FILL_INT_URB(edge_serial->interrupt_read_urb,
-			     serial->dev,
-			     usb_rcvintpipe(serial->dev,
-					    port0->interrupt_in_endpointAddress),
-			     port0->interrupt_in_buffer,
-			     edge_serial->interrupt_read_urb->transfer_buffer_length,
-			     edge_interrupt_callback, edge_serial,
-			     edge_serial->interrupt_read_urb->interval);
+		usb_fill_int_urb(edge_serial->interrupt_read_urb,
+				 serial->dev,
+				 usb_rcvintpipe(serial->dev,
+					        port0->interrupt_in_endpointAddress),
+				 port0->interrupt_in_buffer,
+				 edge_serial->interrupt_read_urb->transfer_buffer_length,
+				 edge_interrupt_callback, edge_serial,
+				 edge_serial->interrupt_read_urb->interval);
 		
 		/* set up our bulk in urb */
-		FILL_BULK_URB(edge_serial->read_urb, serial->dev,
-			      usb_rcvbulkpipe(serial->dev, port0->bulk_in_endpointAddress),
-			      port0->bulk_in_buffer,
-			      edge_serial->read_urb->transfer_buffer_length,
-			      edge_bulk_in_callback, edge_serial);
+		usb_fill_bulk_urb(edge_serial->read_urb, serial->dev,
+				  usb_rcvbulkpipe(serial->dev,
+					  	  port0->bulk_in_endpointAddress),
+				  port0->bulk_in_buffer,
+				  edge_serial->read_urb->transfer_buffer_length,
+				  edge_bulk_in_callback, edge_serial);
 
 		/* start interrupt read for this edgeport
 		 * this interrupt will continue as long as the edgeport is connected */
diff -Nru a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
--- a/drivers/usb/serial/io_ti.c	Mon Oct 28 13:53:49 2002
+++ b/drivers/usb/serial/io_ti.c	Mon Oct 28 13:53:49 2002
@@ -1623,6 +1623,7 @@
 	int length = urb->actual_length;
 	int port_number;
 	int function;
+	int status;
 	__u8 lsr;
 	__u8 msr;
 
@@ -1632,21 +1633,31 @@
 		return;
 	}
 
-	if (urb->status) {
-		dbg("%s - nonzero control read status received: %d", __FUNCTION__, urb->status);
+	switch (urb->status) {
+	case 0:
+		/* success */
+		break;
+	case -ECONNRESET:
+	case -ENOENT:
+	case -ESHUTDOWN:
+		/* this urb is terminated, clean up */
+		dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);
 		return;
+	default:
+		dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
+		goto exit;
 	}
 
 	if (!length) {
 		dbg ("%s - no data in urb", __FUNCTION__);
-		return;
+		goto exit;
 	}
 		
 	usb_serial_debug_data (__FILE__, __FUNCTION__, length, data);
 		
 	if (length != 2) {
 		dbg ("%s - expecting packet of size 2, got %d", __FUNCTION__, length);
-		return;
+		goto exit;
 	}
 
 	port_number = TIUMP_GET_PORT_FROM_CODE (data[0]);
@@ -1694,6 +1705,12 @@
 		break;
 		
 	}
+
+exit:
+	status = usb_submit_urb (urb, GFP_ATOMIC);
+	if (status)
+		err ("%s - usb_submit_urb failed with result %d",
+		     __FUNCTION__, status);
 }
 
 static void edge_bulk_in_callback (struct urb *urb)
@@ -1758,7 +1775,6 @@
 
 exit:
 	/* continue always trying to read */
-	urb->dev = edge_port->port->serial->dev;
 	status = usb_submit_urb (urb, GFP_ATOMIC);
 	if (status)
 		err ("%s - usb_submit_urb failed with result %d",
diff -Nru a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
--- a/drivers/usb/serial/keyspan_pda.c	Mon Oct 28 13:53:49 2002
+++ b/drivers/usb/serial/keyspan_pda.c	Mon Oct 28 13:53:49 2002
@@ -229,12 +229,25 @@
        	struct tty_struct *tty;
 	unsigned char *data = urb->transfer_buffer;
 	int i;
+	int status;
 	struct keyspan_pda_private *priv;
 	priv = (struct keyspan_pda_private *)(port->private);
 
-	/* the urb might have been killed. */
-	if (urb->status)
+	switch (urb->status) {
+	case 0:
+		/* success */
+		break;
+	case -ECONNRESET:
+	case -ENOENT:
+	case -ESHUTDOWN:
+		/* this urb is terminated, clean up */
+		dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);
 		return;
+	default:
+		dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
+		goto exit;
+	}
+
 	
 	if (port_paranoia_check (port, "keyspan_pda_rx_interrupt")) {
 		return;
@@ -277,7 +290,11 @@
 		break;
 	}
 
-	/* INT urbs are automatically re-submitted */
+exit:
+	status = usb_submit_urb (urb, GFP_ATOMIC);
+	if (status)
+		err ("%s - usb_submit_urb failed with result %d",
+		     __FUNCTION__, status);
 }
 
 
diff -Nru a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
--- a/drivers/usb/serial/mct_u232.c	Mon Oct 28 13:53:49 2002
+++ b/drivers/usb/serial/mct_u232.c	Mon Oct 28 13:53:49 2002
@@ -521,15 +521,25 @@
 	struct usb_serial *serial = port->serial;
 	struct tty_struct *tty;
 	unsigned char *data = urb->transfer_buffer;
+	int status;
 
         dbg("%s - port %d", __FUNCTION__, port->number);
 
-	/* The urb might have been killed. */
-        if (urb->status) {
-                dbg("%s - nonzero read bulk status received: %d", __FUNCTION__,
-		    urb->status);
-                return;
-        }
+	switch (urb->status) {
+	case 0:
+		/* success */
+		break;
+	case -ECONNRESET:
+	case -ENOENT:
+	case -ESHUTDOWN:
+		/* this urb is terminated, clean up */
+		dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);
+		return;
+	default:
+		dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
+		goto exit;
+	}
+
 	if (!serial) {
 		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
 		return;
@@ -549,8 +559,7 @@
 			}
 			tty_flip_buffer_push(tty);
 		}
-		/* INT urbs are automatically re-submitted */
-		return;
+		goto exit;
 	}
 	
 	/*
@@ -587,8 +596,11 @@
 		}
 	}
 #endif
-
-	/* INT urbs are automatically re-submitted */
+exit:
+	status = usb_submit_urb (urb, GFP_ATOMIC);
+	if (status)
+		err ("%s - usb_submit_urb failed with result %d",
+		     __FUNCTION__, status);
 } /* mct_u232_read_int_callback */
 
 
diff -Nru a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
--- a/drivers/usb/serial/pl2303.c	Mon Oct 28 13:53:49 2002
+++ b/drivers/usb/serial/pl2303.c	Mon Oct 28 13:53:49 2002
@@ -592,25 +592,36 @@
 	struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
 	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	//unsigned char *data = urb->transfer_buffer;
-	//int i;
+	int status;
 
-//ints auto restart...
-
-	if (!serial) {
+	switch (urb->status) {
+	case 0:
+		/* success */
+		break;
+	case -ECONNRESET:
+	case -ENOENT:
+	case -ESHUTDOWN:
+		/* this urb is terminated, clean up */
+		dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);
 		return;
+	default:
+		dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
+		goto exit;
 	}
 
-	if (urb->status) {
-		urb->status = 0;
+	if (!serial) {
 		return;
 	}
 
 	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
-#if 0
-//FIXME need to update state of terminal lines variable
-#endif
 
-	return;
+	//FIXME need to update state of terminal lines variable
+
+exit:
+	status = usb_submit_urb (urb, GFP_ATOMIC);
+	if (status)
+		err ("%s - usb_submit_urb failed with result %d",
+		     __FUNCTION__, status);
 }