Commit 52171b48 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: serial: ti_usb_3410_5052: 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>
Cc: Al Borchers <alborchers@steinerpoint.com>
Cc: Peter Berger <pberger@brimson.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 17dd2215
...@@ -1112,22 +1112,24 @@ static void ti_interrupt_callback(struct urb *urb) ...@@ -1112,22 +1112,24 @@ static void ti_interrupt_callback(struct urb *urb)
int length = urb->actual_length; int length = urb->actual_length;
int port_number; int port_number;
int function; int function;
int status; int status = urb->status;
int retval;
__u8 msr; __u8 msr;
dbg("%s", __FUNCTION__); dbg("%s", __FUNCTION__);
switch (urb->status) { switch (status) {
case 0: case 0:
break; break;
case -ECONNRESET: case -ECONNRESET:
case -ENOENT: case -ENOENT:
case -ESHUTDOWN: case -ESHUTDOWN:
dbg("%s - urb shutting down, %d", __FUNCTION__, urb->status); dbg("%s - urb shutting down, %d", __FUNCTION__, status);
tdev->td_urb_error = 1; tdev->td_urb_error = 1;
return; return;
default: default:
dev_err(dev, "%s - nonzero urb status, %d\n", __FUNCTION__, urb->status); dev_err(dev, "%s - nonzero urb status, %d\n",
__FUNCTION__, status);
tdev->td_urb_error = 1; tdev->td_urb_error = 1;
goto exit; goto exit;
} }
...@@ -1175,9 +1177,10 @@ static void ti_interrupt_callback(struct urb *urb) ...@@ -1175,9 +1177,10 @@ static void ti_interrupt_callback(struct urb *urb)
} }
exit: exit:
status = usb_submit_urb(urb, GFP_ATOMIC); retval = usb_submit_urb(urb, GFP_ATOMIC);
if (status) if (retval)
dev_err(dev, "%s - resubmit interrupt urb failed, %d\n", __FUNCTION__, status); dev_err(dev, "%s - resubmit interrupt urb failed, %d\n",
__FUNCTION__, retval);
} }
...@@ -1186,30 +1189,32 @@ static void ti_bulk_in_callback(struct urb *urb) ...@@ -1186,30 +1189,32 @@ static void ti_bulk_in_callback(struct urb *urb)
struct ti_port *tport = (struct ti_port *)urb->context; struct ti_port *tport = (struct ti_port *)urb->context;
struct usb_serial_port *port = tport->tp_port; struct usb_serial_port *port = tport->tp_port;
struct device *dev = &urb->dev->dev; struct device *dev = &urb->dev->dev;
int status = 0; int status = urb->status;
int retval = 0;
dbg("%s", __FUNCTION__); dbg("%s", __FUNCTION__);
switch (urb->status) { switch (status) {
case 0: case 0:
break; break;
case -ECONNRESET: case -ECONNRESET:
case -ENOENT: case -ENOENT:
case -ESHUTDOWN: case -ESHUTDOWN:
dbg("%s - urb shutting down, %d", __FUNCTION__, urb->status); dbg("%s - urb shutting down, %d", __FUNCTION__, status);
tport->tp_tdev->td_urb_error = 1; tport->tp_tdev->td_urb_error = 1;
wake_up_interruptible(&tport->tp_write_wait); wake_up_interruptible(&tport->tp_write_wait);
return; return;
default: default:
dev_err(dev, "%s - nonzero urb status, %d\n", __FUNCTION__, urb->status ); dev_err(dev, "%s - nonzero urb status, %d\n",
__FUNCTION__, status );
tport->tp_tdev->td_urb_error = 1; tport->tp_tdev->td_urb_error = 1;
wake_up_interruptible(&tport->tp_write_wait); wake_up_interruptible(&tport->tp_write_wait);
} }
if (urb->status == -EPIPE) if (status == -EPIPE)
goto exit; goto exit;
if (urb->status) { if (status) {
dev_err(dev, "%s - stopping read!\n", __FUNCTION__); dev_err(dev, "%s - stopping read!\n", __FUNCTION__);
return; return;
} }
...@@ -1234,13 +1239,14 @@ exit: ...@@ -1234,13 +1239,14 @@ exit:
spin_lock(&tport->tp_lock); spin_lock(&tport->tp_lock);
if (tport->tp_read_urb_state == TI_READ_URB_RUNNING) { if (tport->tp_read_urb_state == TI_READ_URB_RUNNING) {
urb->dev = port->serial->dev; urb->dev = port->serial->dev;
status = usb_submit_urb(urb, GFP_ATOMIC); retval = usb_submit_urb(urb, GFP_ATOMIC);
} else if (tport->tp_read_urb_state == TI_READ_URB_STOPPING) { } else if (tport->tp_read_urb_state == TI_READ_URB_STOPPING) {
tport->tp_read_urb_state = TI_READ_URB_STOPPED; tport->tp_read_urb_state = TI_READ_URB_STOPPED;
} }
spin_unlock(&tport->tp_lock); spin_unlock(&tport->tp_lock);
if (status) if (retval)
dev_err(dev, "%s - resubmit read urb failed, %d\n", __FUNCTION__, status); dev_err(dev, "%s - resubmit read urb failed, %d\n",
__FUNCTION__, retval);
} }
...@@ -1249,23 +1255,25 @@ static void ti_bulk_out_callback(struct urb *urb) ...@@ -1249,23 +1255,25 @@ static void ti_bulk_out_callback(struct urb *urb)
struct ti_port *tport = (struct ti_port *)urb->context; struct ti_port *tport = (struct ti_port *)urb->context;
struct usb_serial_port *port = tport->tp_port; struct usb_serial_port *port = tport->tp_port;
struct device *dev = &urb->dev->dev; struct device *dev = &urb->dev->dev;
int status = urb->status;
dbg("%s - port %d", __FUNCTION__, port->number); dbg("%s - port %d", __FUNCTION__, port->number);
tport->tp_write_urb_in_use = 0; tport->tp_write_urb_in_use = 0;
switch (urb->status) { switch (status) {
case 0: case 0:
break; break;
case -ECONNRESET: case -ECONNRESET:
case -ENOENT: case -ENOENT:
case -ESHUTDOWN: case -ESHUTDOWN:
dbg("%s - urb shutting down, %d", __FUNCTION__, urb->status); dbg("%s - urb shutting down, %d", __FUNCTION__, status);
tport->tp_tdev->td_urb_error = 1; tport->tp_tdev->td_urb_error = 1;
wake_up_interruptible(&tport->tp_write_wait); wake_up_interruptible(&tport->tp_write_wait);
return; return;
default: default:
dev_err(dev, "%s - nonzero urb status, %d\n", __FUNCTION__, urb->status); dev_err(dev, "%s - nonzero urb status, %d\n",
__FUNCTION__, status);
tport->tp_tdev->td_urb_error = 1; tport->tp_tdev->td_urb_error = 1;
wake_up_interruptible(&tport->tp_write_wait); wake_up_interruptible(&tport->tp_write_wait);
} }
......
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