mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-06 14:45:14 +00:00
USB: serial: cypress_m8: 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: Lonnie Mendez <dignome@gmail.com> Cc: Neil Whelchel <koyama@firstlight.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
7dcc85cd9b
commit
8d7bc55ecf
1 changed files with 11 additions and 7 deletions
|
@ -1275,10 +1275,11 @@ static void cypress_read_int_callback(struct urb *urb)
|
||||||
int bytes = 0;
|
int bytes = 0;
|
||||||
int result;
|
int result;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
int status = urb->status;
|
||||||
|
|
||||||
dbg("%s - port %d", __FUNCTION__, port->number);
|
dbg("%s - port %d", __FUNCTION__, port->number);
|
||||||
|
|
||||||
switch (urb->status) {
|
switch (status) {
|
||||||
case 0: /* success */
|
case 0: /* success */
|
||||||
break;
|
break;
|
||||||
case -ECONNRESET:
|
case -ECONNRESET:
|
||||||
|
@ -1292,7 +1293,7 @@ static void cypress_read_int_callback(struct urb *urb)
|
||||||
default:
|
default:
|
||||||
/* something ugly is going on... */
|
/* something ugly is going on... */
|
||||||
dev_err(&urb->dev->dev,"%s - unexpected nonzero read status received: %d\n",
|
dev_err(&urb->dev->dev,"%s - unexpected nonzero read status received: %d\n",
|
||||||
__FUNCTION__,urb->status);
|
__FUNCTION__, status);
|
||||||
cypress_set_dead(port);
|
cypress_set_dead(port);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1419,10 +1420,11 @@ static void cypress_write_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 cypress_private *priv = usb_get_serial_port_data(port);
|
struct cypress_private *priv = usb_get_serial_port_data(port);
|
||||||
int result;
|
int result;
|
||||||
|
int status = urb->status;
|
||||||
|
|
||||||
dbg("%s - port %d", __FUNCTION__, port->number);
|
dbg("%s - port %d", __FUNCTION__, port->number);
|
||||||
|
|
||||||
switch (urb->status) {
|
switch (status) {
|
||||||
case 0:
|
case 0:
|
||||||
/* success */
|
/* success */
|
||||||
break;
|
break;
|
||||||
|
@ -1430,7 +1432,8 @@ static void cypress_write_int_callback(struct urb *urb)
|
||||||
case -ENOENT:
|
case -ENOENT:
|
||||||
case -ESHUTDOWN:
|
case -ESHUTDOWN:
|
||||||
/* this urb is terminated, clean up */
|
/* this urb is terminated, clean up */
|
||||||
dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);
|
dbg("%s - urb shutting down with status: %d",
|
||||||
|
__FUNCTION__, status);
|
||||||
priv->write_urb_in_use = 0;
|
priv->write_urb_in_use = 0;
|
||||||
return;
|
return;
|
||||||
case -EPIPE: /* no break needed; clear halt and resubmit */
|
case -EPIPE: /* no break needed; clear halt and resubmit */
|
||||||
|
@ -1438,7 +1441,8 @@ static void cypress_write_int_callback(struct urb *urb)
|
||||||
break;
|
break;
|
||||||
usb_clear_halt(port->serial->dev, 0x02);
|
usb_clear_halt(port->serial->dev, 0x02);
|
||||||
/* 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", __FUNCTION__, urb->status);
|
dbg("%s - nonzero write bulk status received: %d",
|
||||||
|
__FUNCTION__, status);
|
||||||
port->interrupt_out_urb->transfer_buffer_length = 1;
|
port->interrupt_out_urb->transfer_buffer_length = 1;
|
||||||
port->interrupt_out_urb->dev = port->serial->dev;
|
port->interrupt_out_urb->dev = port->serial->dev;
|
||||||
result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC);
|
result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC);
|
||||||
|
@ -1450,7 +1454,7 @@ static void cypress_write_int_callback(struct urb *urb)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(&urb->dev->dev,"%s - unexpected nonzero write status received: %d\n",
|
dev_err(&urb->dev->dev,"%s - unexpected nonzero write status received: %d\n",
|
||||||
__FUNCTION__,urb->status);
|
__FUNCTION__, status);
|
||||||
cypress_set_dead(port);
|
cypress_set_dead(port);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue