Commit 3161da97 authored by Oliver Neukum's avatar Oliver Neukum Committed by Johan Hovold

USB: serial: use variable for status

This patch turns status in a variable read once from the URB.
The long term plan is to deliver status to the callback.
In addition it makes the code a bit more elegant.
Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent 3c0415fa
...@@ -350,6 +350,7 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb) ...@@ -350,6 +350,7 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb)
struct usb_serial_port *port = urb->context; struct usb_serial_port *port = urb->context;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
unsigned long flags; unsigned long flags;
int status = urb->status;
int i; int i;
for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) { for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) {
...@@ -360,22 +361,22 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb) ...@@ -360,22 +361,22 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb)
dev_dbg(&port->dev, "%s - urb %d, len %d\n", __func__, i, dev_dbg(&port->dev, "%s - urb %d, len %d\n", __func__, i,
urb->actual_length); urb->actual_length);
switch (urb->status) { switch (status) {
case 0: case 0:
break; break;
case -ENOENT: case -ENOENT:
case -ECONNRESET: case -ECONNRESET:
case -ESHUTDOWN: case -ESHUTDOWN:
dev_dbg(&port->dev, "%s - urb stopped: %d\n", dev_dbg(&port->dev, "%s - urb stopped: %d\n",
__func__, urb->status); __func__, status);
return; return;
case -EPIPE: case -EPIPE:
dev_err(&port->dev, "%s - urb stopped: %d\n", dev_err(&port->dev, "%s - urb stopped: %d\n",
__func__, urb->status); __func__, status);
return; return;
default: default:
dev_dbg(&port->dev, "%s - nonzero urb status: %d\n", dev_dbg(&port->dev, "%s - nonzero urb status: %d\n",
__func__, urb->status); __func__, status);
goto resubmit; goto resubmit;
} }
...@@ -399,6 +400,7 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb) ...@@ -399,6 +400,7 @@ 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) {
...@@ -410,22 +412,22 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb) ...@@ -410,22 +412,22 @@ 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);
switch (urb->status) { switch (status) {
case 0: case 0:
break; break;
case -ENOENT: case -ENOENT:
case -ECONNRESET: case -ECONNRESET:
case -ESHUTDOWN: case -ESHUTDOWN:
dev_dbg(&port->dev, "%s - urb stopped: %d\n", dev_dbg(&port->dev, "%s - urb stopped: %d\n",
__func__, urb->status); __func__, status);
return; return;
case -EPIPE: case -EPIPE:
dev_err_console(port, "%s - urb stopped: %d\n", dev_err_console(port, "%s - urb stopped: %d\n",
__func__, urb->status); __func__, status);
return; return;
default: default:
dev_err_console(port, "%s - nonzero urb status: %d\n", dev_err_console(port, "%s - nonzero urb status: %d\n",
__func__, urb->status); __func__, status);
goto resubmit; goto resubmit;
} }
......
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