diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-06-15 18:44:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-12 19:34:36 -0400 |
commit | 78c26aebd9f4d29f9bd163c7c47f2c89991fcdb1 (patch) | |
tree | 37d40c7511e0b2e133668ae314c0e6459f43082f /drivers/usb/serial | |
parent | d6977b51d5faa8649bbab0e53455e8421d425ce1 (diff) |
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>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r-- | drivers/usb/serial/oti6858.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index 2a609922ab91..d7db71eca520 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
@@ -916,11 +916,12 @@ static void oti6858_read_int_callback(struct urb *urb) | |||
916 | struct usb_serial_port *port = (struct usb_serial_port *) urb->context; | 916 | struct usb_serial_port *port = (struct usb_serial_port *) urb->context; |
917 | struct oti6858_private *priv = usb_get_serial_port_data(port); | 917 | struct oti6858_private *priv = usb_get_serial_port_data(port); |
918 | int transient = 0, can_recv = 0, resubmit = 1; | 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 | dbg("%s(port = %d, status = %d)", |
921 | __FUNCTION__, port->number, urb->status); | 922 | __FUNCTION__, port->number, status); |
922 | 923 | ||
923 | switch (urb->status) { | 924 | switch (status) { |
924 | case 0: | 925 | case 0: |
925 | /* success */ | 926 | /* success */ |
926 | break; | 927 | break; |
@@ -929,15 +930,15 @@ static void oti6858_read_int_callback(struct urb *urb) | |||
929 | case -ESHUTDOWN: | 930 | case -ESHUTDOWN: |
930 | /* this urb is terminated, clean up */ | 931 | /* this urb is terminated, clean up */ |
931 | dbg("%s(): urb shutting down with status: %d", | 932 | dbg("%s(): urb shutting down with status: %d", |
932 | __FUNCTION__, urb->status); | 933 | __FUNCTION__, status); |
933 | return; | 934 | return; |
934 | default: | 935 | default: |
935 | dbg("%s(): nonzero urb status received: %d", | 936 | dbg("%s(): nonzero urb status received: %d", |
936 | __FUNCTION__, urb->status); | 937 | __FUNCTION__, status); |
937 | break; | 938 | break; |
938 | } | 939 | } |
939 | 940 | ||
940 | if (urb->status == 0 && urb->actual_length == OTI6858_CTRL_PKT_SIZE) { | 941 | if (status == 0 && urb->actual_length == OTI6858_CTRL_PKT_SIZE) { |
941 | struct oti6858_control_pkt *xs = urb->transfer_buffer; | 942 | struct oti6858_control_pkt *xs = urb->transfer_buffer; |
942 | unsigned long flags; | 943 | unsigned long flags; |
943 | 944 | ||
@@ -1032,26 +1033,25 @@ static void oti6858_read_bulk_callback(struct urb *urb) | |||
1032 | unsigned char *data = urb->transfer_buffer; | 1033 | unsigned char *data = urb->transfer_buffer; |
1033 | unsigned long flags; | 1034 | unsigned long flags; |
1034 | int i, result; | 1035 | int i, result; |
1036 | int status = urb->status; | ||
1035 | char tty_flag; | 1037 | char tty_flag; |
1036 | 1038 | ||
1037 | dbg("%s(port = %d, urb->status = %d)", | 1039 | dbg("%s(port = %d, status = %d)", |
1038 | __FUNCTION__, port->number, urb->status); | 1040 | __FUNCTION__, port->number, status); |
1039 | 1041 | ||
1040 | spin_lock_irqsave(&priv->lock, flags); | 1042 | spin_lock_irqsave(&priv->lock, flags); |
1041 | priv->flags.read_urb_in_use = 0; | 1043 | priv->flags.read_urb_in_use = 0; |
1042 | spin_unlock_irqrestore(&priv->lock, flags); | 1044 | spin_unlock_irqrestore(&priv->lock, flags); |
1043 | 1045 | ||
1044 | if (urb->status != 0) { | 1046 | if (status != 0) { |
1045 | if (!port->open_count) { | 1047 | if (!port->open_count) { |
1046 | dbg("%s(): port is closed, exiting", __FUNCTION__); | 1048 | dbg("%s(): port is closed, exiting", __FUNCTION__); |
1047 | return; | 1049 | return; |
1048 | } | 1050 | } |
1049 | /* | 1051 | /* |
1050 | if (urb->status == -EPROTO) { | 1052 | if (status == -EPROTO) { |
1051 | // PL2303 mysteriously fails with -EPROTO reschedule the read | 1053 | // PL2303 mysteriously fails with -EPROTO reschedule the read |
1052 | dbg("%s - caught -EPROTO, resubmitting the urb", __FUNCTION__); | 1054 | dbg("%s - caught -EPROTO, resubmitting the urb", __FUNCTION__); |
1053 | urb->status = 0; | ||
1054 | urb->dev = port->serial->dev; | ||
1055 | result = usb_submit_urb(urb, GFP_ATOMIC); | 1055 | result = usb_submit_urb(urb, GFP_ATOMIC); |
1056 | if (result) | 1056 | if (result) |
1057 | dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); | 1057 | 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 | { | 1101 | { |
1102 | struct usb_serial_port *port = (struct usb_serial_port *) urb->context; | 1102 | struct usb_serial_port *port = (struct usb_serial_port *) urb->context; |
1103 | struct oti6858_private *priv = usb_get_serial_port_data(port); | 1103 | struct oti6858_private *priv = usb_get_serial_port_data(port); |
1104 | int status = urb->status; | ||
1104 | int result; | 1105 | int result; |
1105 | 1106 | ||
1106 | dbg("%s(port = %d, urb->status = %d)", | 1107 | dbg("%s(port = %d, status = %d)", |
1107 | __FUNCTION__, port->number, urb->status); | 1108 | __FUNCTION__, port->number, status); |
1108 | 1109 | ||
1109 | switch (urb->status) { | 1110 | switch (status) { |
1110 | case 0: | 1111 | case 0: |
1111 | /* success */ | 1112 | /* success */ |
1112 | break; | 1113 | break; |
@@ -1115,13 +1116,13 @@ static void oti6858_write_bulk_callback(struct urb *urb) | |||
1115 | case -ESHUTDOWN: | 1116 | case -ESHUTDOWN: |
1116 | /* this urb is terminated, clean up */ | 1117 | /* this urb is terminated, clean up */ |
1117 | dbg("%s(): urb shutting down with status: %d", | 1118 | dbg("%s(): urb shutting down with status: %d", |
1118 | __FUNCTION__, urb->status); | 1119 | __FUNCTION__, status); |
1119 | priv->flags.write_urb_in_use = 0; | 1120 | priv->flags.write_urb_in_use = 0; |
1120 | return; | 1121 | return; |
1121 | default: | 1122 | default: |
1122 | /* error in the urb, so we have to resubmit it */ | 1123 | /* error in the urb, so we have to resubmit it */ |
1123 | dbg("%s(): nonzero write bulk status received: %d", | 1124 | dbg("%s(): nonzero write bulk status received: %d", |
1124 | __FUNCTION__, urb->status); | 1125 | __FUNCTION__, status); |
1125 | dbg("%s(): overflow in write", __FUNCTION__); | 1126 | dbg("%s(): overflow in write", __FUNCTION__); |
1126 | 1127 | ||
1127 | port->write_urb->transfer_buffer_length = 1; | 1128 | port->write_urb->transfer_buffer_length = 1; |