Skip to content

Commit

Permalink
USB: serial: continue to read on errors
Browse files Browse the repository at this point in the history
Make sure to try to resubmit the read urb on errors.

Currently a recoverable error would lead to reduced throughput as only
one urb will be used until the port is closed and reopened (or
resumed or unthrottled).

Also upgrade error messages from debug to error log level.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed Mar 12, 2014
1 parent 5083fd7 commit fc11efe
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions drivers/usb/serial/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,16 +359,29 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb)

dev_dbg(&port->dev, "%s - urb %d, len %d\n", __func__, i,
urb->actual_length);

if (urb->status) {
dev_dbg(&port->dev, "%s - non-zero urb status: %d\n",
__func__, urb->status);
switch (urb->status) {
case 0:
break;
case -ENOENT:
case -ECONNRESET:
case -ESHUTDOWN:
dev_dbg(&port->dev, "%s - urb stopped: %d\n",
__func__, urb->status);
return;
case -EPIPE:
dev_err(&port->dev, "%s - urb stopped: %d\n",
__func__, urb->status);
return;
default:
dev_err(&port->dev, "%s - nonzero urb status: %d\n",
__func__, urb->status);
goto resubmit;
}

usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data);
port->serial->type->process_read_urb(urb);

resubmit:
/* Throttle the device if requested by tty */
spin_lock_irqsave(&port->lock, flags);
port->throttled = port->throttle_req;
Expand Down

0 comments on commit fc11efe

Please sign in to comment.