]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
USB: serial: continue to read on errors
authorJohan Hovold <jhovold@gmail.com>
Wed, 12 Mar 2014 18:09:39 +0000 (19:09 +0100)
committerGreg Kroah-Hartman <greg@kroah.com>
Wed, 12 Mar 2014 19:44:49 +0000 (12:44 -0700)
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>
drivers/usb/serial/generic.c

index b63ce023f96f1ab7284e218ca68219da5f952440..d7f39ea7d6acc8203392fbbe6e1ef6df727179fa 100644 (file)
@@ -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;