Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Greg Kroah-Hartman <gregkh@suse.de>

+18 -17
+18 -17
drivers/usb/serial/oti6858.c
··· 916 916 struct usb_serial_port *port = (struct usb_serial_port *) urb->context; 917 917 struct oti6858_private *priv = usb_get_serial_port_data(port); 918 918 int transient = 0, can_recv = 0, resubmit = 1; 919 + int status = urb->status; 919 920 920 - dbg("%s(port = %d, urb->status = %d)", 921 - __FUNCTION__, port->number, urb->status); 921 + dbg("%s(port = %d, status = %d)", 922 + __FUNCTION__, port->number, status); 922 923 923 - switch (urb->status) { 924 + switch (status) { 924 925 case 0: 925 926 /* success */ 926 927 break; ··· 930 929 case -ESHUTDOWN: 931 930 /* this urb is terminated, clean up */ 932 931 dbg("%s(): urb shutting down with status: %d", 933 - __FUNCTION__, urb->status); 932 + __FUNCTION__, status); 934 933 return; 935 934 default: 936 935 dbg("%s(): nonzero urb status received: %d", 937 - __FUNCTION__, urb->status); 936 + __FUNCTION__, status); 938 937 break; 939 938 } 940 939 941 - if (urb->status == 0 && urb->actual_length == OTI6858_CTRL_PKT_SIZE) { 940 + if (status == 0 && urb->actual_length == OTI6858_CTRL_PKT_SIZE) { 942 941 struct oti6858_control_pkt *xs = urb->transfer_buffer; 943 942 unsigned long flags; 944 943 ··· 1033 1032 unsigned char *data = urb->transfer_buffer; 1034 1033 unsigned long flags; 1035 1034 int i, result; 1035 + int status = urb->status; 1036 1036 char tty_flag; 1037 1037 1038 - dbg("%s(port = %d, urb->status = %d)", 1039 - __FUNCTION__, port->number, urb->status); 1038 + dbg("%s(port = %d, status = %d)", 1039 + __FUNCTION__, port->number, status); 1040 1040 1041 1041 spin_lock_irqsave(&priv->lock, flags); 1042 1042 priv->flags.read_urb_in_use = 0; 1043 1043 spin_unlock_irqrestore(&priv->lock, flags); 1044 1044 1045 - if (urb->status != 0) { 1045 + if (status != 0) { 1046 1046 if (!port->open_count) { 1047 1047 dbg("%s(): port is closed, exiting", __FUNCTION__); 1048 1048 return; 1049 1049 } 1050 1050 /* 1051 - if (urb->status == -EPROTO) { 1051 + if (status == -EPROTO) { 1052 1052 // PL2303 mysteriously fails with -EPROTO reschedule the read 1053 1053 dbg("%s - caught -EPROTO, resubmitting the urb", __FUNCTION__); 1054 - urb->status = 0; 1055 - urb->dev = port->serial->dev; 1056 1054 result = usb_submit_urb(urb, GFP_ATOMIC); 1057 1055 if (result) 1058 1056 dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); ··· 1101 1101 { 1102 1102 struct usb_serial_port *port = (struct usb_serial_port *) urb->context; 1103 1103 struct oti6858_private *priv = usb_get_serial_port_data(port); 1104 + int status = urb->status; 1104 1105 int result; 1105 1106 1106 - dbg("%s(port = %d, urb->status = %d)", 1107 - __FUNCTION__, port->number, urb->status); 1107 + dbg("%s(port = %d, status = %d)", 1108 + __FUNCTION__, port->number, status); 1108 1109 1109 - switch (urb->status) { 1110 + switch (status) { 1110 1111 case 0: 1111 1112 /* success */ 1112 1113 break; ··· 1116 1115 case -ESHUTDOWN: 1117 1116 /* this urb is terminated, clean up */ 1118 1117 dbg("%s(): urb shutting down with status: %d", 1119 - __FUNCTION__, urb->status); 1118 + __FUNCTION__, status); 1120 1119 priv->flags.write_urb_in_use = 0; 1121 1120 return; 1122 1121 default: 1123 1122 /* error in the urb, so we have to resubmit it */ 1124 1123 dbg("%s(): nonzero write bulk status received: %d", 1125 - __FUNCTION__, urb->status); 1124 + __FUNCTION__, status); 1126 1125 dbg("%s(): overflow in write", __FUNCTION__); 1127 1126 1128 1127 port->write_urb->transfer_buffer_length = 1;