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)
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;
......@@ -321,8 +333,11 @@ static void belkin_sa_read_int_callback (struct urb *urb)
}
}
#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)
......
......@@ -772,9 +772,19 @@ static void edge_interrupt_callback (struct urb *urb)
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 @@ static void edge_interrupt_callback (struct urb *urb)
++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)
edge_serial->bulk_out_endpoint = port0->bulk_out_endpointAddress;
/* set up our interrupt urb */
FILL_INT_URB(edge_serial->interrupt_read_urb,
usb_fill_int_urb(edge_serial->interrupt_read_urb,
serial->dev,
usb_rcvintpipe(serial->dev,
port0->interrupt_in_endpointAddress),
......@@ -1030,8 +1046,9 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
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),
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);
......
......@@ -1623,6 +1623,7 @@ static void edge_interrupt_callback (struct urb *urb)
int length = urb->actual_length;
int port_number;
int function;
int status;
__u8 lsr;
__u8 msr;
......@@ -1632,21 +1633,31 @@ static void edge_interrupt_callback (struct urb *urb)
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 @@ static void edge_interrupt_callback (struct urb *urb)
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 @@ static void edge_bulk_in_callback (struct urb *urb)
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",
......
......@@ -229,12 +229,25 @@ static void keyspan_pda_rx_interrupt (struct urb *urb)
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 @@ static void keyspan_pda_rx_interrupt (struct urb *urb)
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)
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);
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 @@ static void mct_u232_read_int_callback (struct urb *urb)
}
tty_flip_buffer_push(tty);
}
/* INT urbs are automatically re-submitted */
return;
goto exit;
}
/*
......@@ -587,8 +596,11 @@ static void mct_u232_read_int_callback (struct urb *urb)
}
}
#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 */
......
......@@ -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 *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);
}
......
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