Commit 1373dbbc authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: serial: aircable: clean up urb->status usage

This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 4d0dce3e
...@@ -411,12 +411,13 @@ static int aircable_write(struct usb_serial_port *port, ...@@ -411,12 +411,13 @@ static int aircable_write(struct usb_serial_port *port,
static void aircable_write_bulk_callback(struct urb *urb) static void aircable_write_bulk_callback(struct urb *urb)
{ {
struct usb_serial_port *port = urb->context; struct usb_serial_port *port = urb->context;
int status = urb->status;
int result; int result;
dbg("%s - urb->status: %d", __FUNCTION__ , urb->status); dbg("%s - urb status: %d", __FUNCTION__ , status);
/* This has been taken from cypress_m8.c cypress_write_int_callback */ /* This has been taken from cypress_m8.c cypress_write_int_callback */
switch (urb->status) { switch (status) {
case 0: case 0:
/* success */ /* success */
break; break;
...@@ -425,14 +426,14 @@ static void aircable_write_bulk_callback(struct urb *urb) ...@@ -425,14 +426,14 @@ static void aircable_write_bulk_callback(struct urb *urb)
case -ESHUTDOWN: case -ESHUTDOWN:
/* this urb is terminated, clean up */ /* this urb is terminated, clean up */
dbg("%s - urb shutting down with status: %d", dbg("%s - urb shutting down with status: %d",
__FUNCTION__, urb->status); __FUNCTION__, status);
port->write_urb_busy = 0; port->write_urb_busy = 0;
return; return;
default: default:
/* error in the urb, so we have to resubmit it */ /* error in the urb, so we have to resubmit it */
dbg("%s - Overflow in write", __FUNCTION__); dbg("%s - Overflow in write", __FUNCTION__);
dbg("%s - nonzero write bulk status received: %d", dbg("%s - nonzero write bulk status received: %d",
__FUNCTION__, urb->status); __FUNCTION__, status);
port->write_urb->transfer_buffer_length = 1; port->write_urb->transfer_buffer_length = 1;
port->write_urb->dev = port->serial->dev; port->write_urb->dev = port->serial->dev;
result = usb_submit_urb(port->write_urb, GFP_ATOMIC); result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
...@@ -457,16 +458,17 @@ static void aircable_read_bulk_callback(struct urb *urb) ...@@ -457,16 +458,17 @@ static void aircable_read_bulk_callback(struct urb *urb)
unsigned long no_packages, remaining, package_length, i; unsigned long no_packages, remaining, package_length, i;
int result, shift = 0; int result, shift = 0;
unsigned char *temp; unsigned char *temp;
int status = urb->status;
dbg("%s - port %d", __FUNCTION__, port->number); dbg("%s - port %d", __FUNCTION__, port->number);
if (urb->status) { if (status) {
dbg("%s - urb->status = %d", __FUNCTION__, urb->status); dbg("%s - urb status = %d", __FUNCTION__, status);
if (!port->open_count) { if (!port->open_count) {
dbg("%s - port is closed, exiting.", __FUNCTION__); dbg("%s - port is closed, exiting.", __FUNCTION__);
return; return;
} }
if (urb->status == -EPROTO) { if (status == -EPROTO) {
dbg("%s - caught -EPROTO, resubmitting the urb", dbg("%s - caught -EPROTO, resubmitting the urb",
__FUNCTION__); __FUNCTION__);
usb_fill_bulk_urb(port->read_urb, port->serial->dev, usb_fill_bulk_urb(port->read_urb, port->serial->dev,
......
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