Commit 78c26aeb authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: serial: oti6858: 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 d6977b51
...@@ -916,11 +916,12 @@ static void oti6858_read_int_callback(struct urb *urb) ...@@ -916,11 +916,12 @@ static void oti6858_read_int_callback(struct urb *urb)
struct usb_serial_port *port = (struct usb_serial_port *) urb->context; struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
struct oti6858_private *priv = usb_get_serial_port_data(port); struct oti6858_private *priv = usb_get_serial_port_data(port);
int transient = 0, can_recv = 0, resubmit = 1; int transient = 0, can_recv = 0, resubmit = 1;
int status = urb->status;
dbg("%s(port = %d, urb->status = %d)", dbg("%s(port = %d, status = %d)",
__FUNCTION__, port->number, urb->status); __FUNCTION__, port->number, status);
switch (urb->status) { switch (status) {
case 0: case 0:
/* success */ /* success */
break; break;
...@@ -929,15 +930,15 @@ static void oti6858_read_int_callback(struct urb *urb) ...@@ -929,15 +930,15 @@ static void oti6858_read_int_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);
return; return;
default: default:
dbg("%s(): nonzero urb status received: %d", dbg("%s(): nonzero urb status received: %d",
__FUNCTION__, urb->status); __FUNCTION__, status);
break; break;
} }
if (urb->status == 0 && urb->actual_length == OTI6858_CTRL_PKT_SIZE) { if (status == 0 && urb->actual_length == OTI6858_CTRL_PKT_SIZE) {
struct oti6858_control_pkt *xs = urb->transfer_buffer; struct oti6858_control_pkt *xs = urb->transfer_buffer;
unsigned long flags; unsigned long flags;
...@@ -1032,26 +1033,25 @@ static void oti6858_read_bulk_callback(struct urb *urb) ...@@ -1032,26 +1033,25 @@ static void oti6858_read_bulk_callback(struct urb *urb)
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
unsigned long flags; unsigned long flags;
int i, result; int i, result;
int status = urb->status;
char tty_flag; char tty_flag;
dbg("%s(port = %d, urb->status = %d)", dbg("%s(port = %d, status = %d)",
__FUNCTION__, port->number, urb->status); __FUNCTION__, port->number, status);
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
priv->flags.read_urb_in_use = 0; priv->flags.read_urb_in_use = 0;
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
if (urb->status != 0) { if (status != 0) {
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) {
// PL2303 mysteriously fails with -EPROTO reschedule the read // PL2303 mysteriously fails with -EPROTO reschedule the read
dbg("%s - caught -EPROTO, resubmitting the urb", __FUNCTION__); dbg("%s - caught -EPROTO, resubmitting the urb", __FUNCTION__);
urb->status = 0;
urb->dev = port->serial->dev;
result = usb_submit_urb(urb, GFP_ATOMIC); result = usb_submit_urb(urb, GFP_ATOMIC);
if (result) if (result)
dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
...@@ -1101,12 +1101,13 @@ static void oti6858_write_bulk_callback(struct urb *urb) ...@@ -1101,12 +1101,13 @@ static void oti6858_write_bulk_callback(struct urb *urb)
{ {
struct usb_serial_port *port = (struct usb_serial_port *) urb->context; struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
struct oti6858_private *priv = usb_get_serial_port_data(port); struct oti6858_private *priv = usb_get_serial_port_data(port);
int status = urb->status;
int result; int result;
dbg("%s(port = %d, urb->status = %d)", dbg("%s(port = %d, status = %d)",
__FUNCTION__, port->number, urb->status); __FUNCTION__, port->number, status);
switch (urb->status) { switch (status) {
case 0: case 0:
/* success */ /* success */
break; break;
...@@ -1115,13 +1116,13 @@ static void oti6858_write_bulk_callback(struct urb *urb) ...@@ -1115,13 +1116,13 @@ static void oti6858_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);
priv->flags.write_urb_in_use = 0; priv->flags.write_urb_in_use = 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(): nonzero write bulk status received: %d", dbg("%s(): nonzero write bulk status received: %d",
__FUNCTION__, urb->status); __FUNCTION__, status);
dbg("%s(): overflow in write", __FUNCTION__); dbg("%s(): overflow in write", __FUNCTION__);
port->write_urb->transfer_buffer_length = 1; port->write_urb->transfer_buffer_length = 1;
......
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