Commit bd58c7bd authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: serial: continue to write on errors

Do not discard buffered data and make sure to try to resubmit the write
urbs on errors.

Currently a recoverable error would lead to more data than necessary
being dropped.

Also upgrade error messages from debug to error log level.
Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent fc11efe2
...@@ -397,7 +397,6 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb) ...@@ -397,7 +397,6 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb)
{ {
unsigned long flags; unsigned long flags;
struct usb_serial_port *port = urb->context; struct usb_serial_port *port = urb->context;
int status = urb->status;
int i; int i;
for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i)
...@@ -409,17 +408,27 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb) ...@@ -409,17 +408,27 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb)
set_bit(i, &port->write_urbs_free); set_bit(i, &port->write_urbs_free);
spin_unlock_irqrestore(&port->lock, flags); spin_unlock_irqrestore(&port->lock, flags);
if (status) { switch (urb->status) {
dev_dbg(&port->dev, "%s - non-zero urb status: %d\n", case 0:
__func__, status); break;
case -ENOENT:
spin_lock_irqsave(&port->lock, flags); case -ECONNRESET:
kfifo_reset_out(&port->write_fifo); case -ESHUTDOWN:
spin_unlock_irqrestore(&port->lock, flags); dev_dbg(&port->dev, "%s - urb stopped: %d\n",
} else { __func__, urb->status);
usb_serial_generic_write_start(port, GFP_ATOMIC); return;
case -EPIPE:
dev_err_console(port, "%s - urb stopped: %d\n",
__func__, urb->status);
return;
default:
dev_err_console(port, "%s - nonzero urb status: %d\n",
__func__, urb->status);
goto resubmit;
} }
resubmit:
usb_serial_generic_write_start(port, GFP_ATOMIC);
usb_serial_port_softint(port); usb_serial_port_softint(port);
} }
EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback); EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback);
......
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