Commit f821cacc authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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

USB: fix the usb serial drivers due to interrupt urb no automatic resubmission change to the usb core.
parent e9c72b55
...@@ -258,10 +258,22 @@ static void belkin_sa_read_int_callback (struct urb *urb) ...@@ -258,10 +258,22 @@ static void belkin_sa_read_int_callback (struct urb *urb)
struct belkin_sa_private *priv; struct belkin_sa_private *priv;
struct usb_serial *serial; struct usb_serial *serial;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
int retval;
/* the urb might have been killed. */ switch (urb->status) {
if (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; return;
default:
dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
goto exit;
}
if (port_paranoia_check (port, __FUNCTION__)) return; if (port_paranoia_check (port, __FUNCTION__)) return;
...@@ -321,8 +333,11 @@ static void belkin_sa_read_int_callback (struct urb *urb) ...@@ -321,8 +333,11 @@ static void belkin_sa_read_int_callback (struct urb *urb)
} }
} }
#endif #endif
exit:
/* INT urbs are automatically re-submitted */ 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) static void belkin_sa_set_termios (struct usb_serial_port *port, struct termios *old_termios)
......
...@@ -772,9 +772,19 @@ static void edge_interrupt_callback (struct urb *urb) ...@@ -772,9 +772,19 @@ static void edge_interrupt_callback (struct urb *urb)
return; return;
} }
if (urb->status) { switch (urb->status) {
dbg("%s - nonzero control read status received: %d", __FUNCTION__, 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; 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 // process this interrupt-read even if there are no ports open
...@@ -826,6 +836,12 @@ static void edge_interrupt_callback (struct urb *urb) ...@@ -826,6 +836,12 @@ static void edge_interrupt_callback (struct urb *urb)
++portNumber; ++portNumber;
} }
} }
exit:
result = usb_submit_urb (urb, GFP_ATOMIC);
if (result) {
err("%s - Error %d submitting control urb", __FUNCTION__, result);
}
} }
...@@ -1020,7 +1036,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) ...@@ -1020,7 +1036,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
edge_serial->bulk_out_endpoint = port0->bulk_out_endpointAddress; edge_serial->bulk_out_endpoint = port0->bulk_out_endpointAddress;
/* set up our interrupt urb */ /* set up our interrupt urb */
FILL_INT_URB(edge_serial->interrupt_read_urb, usb_fill_int_urb(edge_serial->interrupt_read_urb,
serial->dev, serial->dev,
usb_rcvintpipe(serial->dev, usb_rcvintpipe(serial->dev,
port0->interrupt_in_endpointAddress), port0->interrupt_in_endpointAddress),
...@@ -1030,8 +1046,9 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) ...@@ -1030,8 +1046,9 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
edge_serial->interrupt_read_urb->interval); edge_serial->interrupt_read_urb->interval);
/* set up our bulk in urb */ /* set up our bulk in urb */
FILL_BULK_URB(edge_serial->read_urb, serial->dev, usb_fill_bulk_urb(edge_serial->read_urb, serial->dev,
usb_rcvbulkpipe(serial->dev, port0->bulk_in_endpointAddress), usb_rcvbulkpipe(serial->dev,
port0->bulk_in_endpointAddress),
port0->bulk_in_buffer, port0->bulk_in_buffer,
edge_serial->read_urb->transfer_buffer_length, edge_serial->read_urb->transfer_buffer_length,
edge_bulk_in_callback, edge_serial); edge_bulk_in_callback, edge_serial);
......
...@@ -1623,6 +1623,7 @@ static void edge_interrupt_callback (struct urb *urb) ...@@ -1623,6 +1623,7 @@ static void edge_interrupt_callback (struct urb *urb)
int length = urb->actual_length; int length = urb->actual_length;
int port_number; int port_number;
int function; int function;
int status;
__u8 lsr; __u8 lsr;
__u8 msr; __u8 msr;
...@@ -1632,21 +1633,31 @@ static void edge_interrupt_callback (struct urb *urb) ...@@ -1632,21 +1633,31 @@ static void edge_interrupt_callback (struct urb *urb)
return; return;
} }
if (urb->status) { switch (urb->status) {
dbg("%s - nonzero control read status received: %d", __FUNCTION__, 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; return;
default:
dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
goto exit;
} }
if (!length) { if (!length) {
dbg ("%s - no data in urb", __FUNCTION__); dbg ("%s - no data in urb", __FUNCTION__);
return; goto exit;
} }
usb_serial_debug_data (__FILE__, __FUNCTION__, length, data); usb_serial_debug_data (__FILE__, __FUNCTION__, length, data);
if (length != 2) { if (length != 2) {
dbg ("%s - expecting packet of size 2, got %d", __FUNCTION__, length); dbg ("%s - expecting packet of size 2, got %d", __FUNCTION__, length);
return; goto exit;
} }
port_number = TIUMP_GET_PORT_FROM_CODE (data[0]); port_number = TIUMP_GET_PORT_FROM_CODE (data[0]);
...@@ -1694,6 +1705,12 @@ static void edge_interrupt_callback (struct urb *urb) ...@@ -1694,6 +1705,12 @@ static void edge_interrupt_callback (struct urb *urb)
break; 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) static void edge_bulk_in_callback (struct urb *urb)
...@@ -1758,7 +1775,6 @@ static void edge_bulk_in_callback (struct urb *urb) ...@@ -1758,7 +1775,6 @@ static void edge_bulk_in_callback (struct urb *urb)
exit: exit:
/* continue always trying to read */ /* continue always trying to read */
urb->dev = edge_port->port->serial->dev;
status = usb_submit_urb (urb, GFP_ATOMIC); status = usb_submit_urb (urb, GFP_ATOMIC);
if (status) if (status)
err ("%s - usb_submit_urb failed with result %d", err ("%s - usb_submit_urb failed with result %d",
......
...@@ -229,12 +229,25 @@ static void keyspan_pda_rx_interrupt (struct urb *urb) ...@@ -229,12 +229,25 @@ static void keyspan_pda_rx_interrupt (struct urb *urb)
struct tty_struct *tty; struct tty_struct *tty;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
int i; int i;
int status;
struct keyspan_pda_private *priv; struct keyspan_pda_private *priv;
priv = (struct keyspan_pda_private *)(port->private); priv = (struct keyspan_pda_private *)(port->private);
/* the urb might have been killed. */ switch (urb->status) {
if (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; return;
default:
dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
goto exit;
}
if (port_paranoia_check (port, "keyspan_pda_rx_interrupt")) { if (port_paranoia_check (port, "keyspan_pda_rx_interrupt")) {
return; return;
...@@ -277,7 +290,11 @@ static void keyspan_pda_rx_interrupt (struct urb *urb) ...@@ -277,7 +290,11 @@ static void keyspan_pda_rx_interrupt (struct urb *urb)
break; 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);
} }
......
...@@ -521,15 +521,25 @@ static void mct_u232_read_int_callback (struct urb *urb) ...@@ -521,15 +521,25 @@ static void mct_u232_read_int_callback (struct urb *urb)
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
struct tty_struct *tty; struct tty_struct *tty;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
int status;
dbg("%s - port %d", __FUNCTION__, port->number); dbg("%s - port %d", __FUNCTION__, port->number);
/* The urb might have been killed. */ switch (urb->status) {
if (urb->status) { case 0:
dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, /* success */
urb->status); 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; return;
default:
dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
goto exit;
} }
if (!serial) { if (!serial) {
dbg("%s - bad serial pointer, exiting", __FUNCTION__); dbg("%s - bad serial pointer, exiting", __FUNCTION__);
return; return;
...@@ -549,8 +559,7 @@ static void mct_u232_read_int_callback (struct urb *urb) ...@@ -549,8 +559,7 @@ static void mct_u232_read_int_callback (struct urb *urb)
} }
tty_flip_buffer_push(tty); tty_flip_buffer_push(tty);
} }
/* INT urbs are automatically re-submitted */ goto exit;
return;
} }
/* /*
...@@ -587,8 +596,11 @@ static void mct_u232_read_int_callback (struct urb *urb) ...@@ -587,8 +596,11 @@ static void mct_u232_read_int_callback (struct urb *urb)
} }
} }
#endif #endif
exit:
/* INT urbs are automatically re-submitted */ 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 */ } /* mct_u232_read_int_callback */
......
...@@ -592,25 +592,36 @@ static void pl2303_read_int_callback (struct urb *urb) ...@@ -592,25 +592,36 @@ static void pl2303_read_int_callback (struct urb *urb)
struct usb_serial_port *port = (struct usb_serial_port *) urb->context; struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
struct usb_serial *serial = get_usb_serial (port, __FUNCTION__); struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
//unsigned char *data = urb->transfer_buffer; //unsigned char *data = urb->transfer_buffer;
//int i; int status;
//ints auto restart... switch (urb->status) {
case 0:
if (!serial) { /* 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; return;
default:
dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
goto exit;
} }
if (urb->status) { if (!serial) {
urb->status = 0;
return; return;
} }
usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer); 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);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment