提交 38e8c910 编写于 作者: G Greg Kroah-Hartman

USB: serial: visor: 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: NGreg Kroah-Hartman <gregkh@suse.de>
上级 52171b48
...@@ -485,16 +485,17 @@ static void visor_write_bulk_callback (struct urb *urb) ...@@ -485,16 +485,17 @@ static void visor_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 visor_private *priv = usb_get_serial_port_data(port); struct visor_private *priv = usb_get_serial_port_data(port);
int status = urb->status;
unsigned long flags; unsigned long flags;
/* free up the transfer buffer, as usb_free_urb() does not do this */ /* free up the transfer buffer, as usb_free_urb() does not do this */
kfree (urb->transfer_buffer); kfree (urb->transfer_buffer);
dbg("%s - port %d", __FUNCTION__, port->number); dbg("%s - port %d", __FUNCTION__, port->number);
if (urb->status) if (status)
dbg("%s - nonzero write bulk status received: %d", dbg("%s - nonzero write bulk status received: %d",
__FUNCTION__, urb->status); __FUNCTION__, status);
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
--priv->outstanding_urbs; --priv->outstanding_urbs;
...@@ -509,14 +510,16 @@ static void visor_read_bulk_callback (struct urb *urb) ...@@ -509,14 +510,16 @@ static void visor_read_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 visor_private *priv = usb_get_serial_port_data(port); struct visor_private *priv = usb_get_serial_port_data(port);
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
int status = urb->status;
struct tty_struct *tty; struct tty_struct *tty;
int result; int result;
int available_room; int available_room;
dbg("%s - port %d", __FUNCTION__, port->number); dbg("%s - port %d", __FUNCTION__, port->number);
if (urb->status) { if (status) {
dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status); dbg("%s - nonzero read bulk status received: %d",
__FUNCTION__, status);
return; return;
} }
...@@ -556,9 +559,10 @@ static void visor_read_bulk_callback (struct urb *urb) ...@@ -556,9 +559,10 @@ static void visor_read_bulk_callback (struct urb *urb)
static void visor_read_int_callback (struct urb *urb) static void visor_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;
int status = urb->status;
int result; int result;
switch (urb->status) { switch (status) {
case 0: case 0:
/* success */ /* success */
break; break;
...@@ -567,11 +571,11 @@ static void visor_read_int_callback (struct urb *urb) ...@@ -567,11 +571,11 @@ static void visor_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);
goto exit; goto exit;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册