aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorJames Maki <jamescmaki@gmail.com>2010-03-21 13:53:59 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-20 16:21:35 -0400
commite618834ef9608750a36d03d4aa9a9f931aa788d6 (patch)
tree3b64a4822cc702b49c57d9ca2223d213fba3525f /drivers/usb/serial
parent71adf118946957839a13aa4d1094183e05c6c094 (diff)
USB: option.c: option_indat_callback: Resubmit some unsuccessful URBs
All unsuccessful (non-zero status) URBs were being dropped. After N_IN_URBs are dropped you will no longer be able to receive data. This patch resubmits unsuccessful URBs unless the status indicates that it should be terminated. The statuses that indicate the URB should be terminated was gathered from other similar drivers. Signed-off-by: James Maki <jamescmaki@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/option.c49
1 files changed, 30 insertions, 19 deletions
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 84d0edad8e4f..6d0dfd7da98c 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1019,31 +1019,42 @@ static void option_indat_callback(struct urb *urb)
1019 dbg("%s: %p", __func__, urb); 1019 dbg("%s: %p", __func__, urb);
1020 1020
1021 endpoint = usb_pipeendpoint(urb->pipe); 1021 endpoint = usb_pipeendpoint(urb->pipe);
1022 port = urb->context; 1022 port = urb->context;
1023 1023
1024 if (status) { 1024 switch (status) {
1025 case 0:
1026 /* success */
1027 break;
1028 case -ECONNRESET:
1029 case -ENOENT:
1030 case -ESHUTDOWN:
1031 /* this urb is terminated, clean up */
1032 dbg("%s: urb shutting down with status: %d on endpoint %02x.",
1033 __func__, status, endpoint);
1034 return;
1035 default:
1025 dbg("%s: nonzero status: %d on endpoint %02x.", 1036 dbg("%s: nonzero status: %d on endpoint %02x.",
1026 __func__, status, endpoint); 1037 __func__, status, endpoint);
1027 } else { 1038 goto exit;
1039 }
1040
1041 if (urb->actual_length) {
1028 tty = tty_port_tty_get(&port->port); 1042 tty = tty_port_tty_get(&port->port);
1029 if (urb->actual_length) { 1043 tty_insert_flip_string(tty, data, urb->actual_length);
1030 tty_insert_flip_string(tty, data, urb->actual_length); 1044 tty_flip_buffer_push(tty);
1031 tty_flip_buffer_push(tty);
1032 } else
1033 dbg("%s: empty read urb received", __func__);
1034 tty_kref_put(tty); 1045 tty_kref_put(tty);
1046 } else
1047 dbg("%s: empty read urb received", __func__);
1035 1048
1036 /* Resubmit urb so we continue receiving */ 1049exit:
1037 if (status != -ESHUTDOWN) { 1050 /* Resubmit urb so we continue receiving */
1038 err = usb_submit_urb(urb, GFP_ATOMIC); 1051 err = usb_submit_urb(urb, GFP_ATOMIC);
1039 if (err && err != -EPERM) 1052 if (err && err != -EPERM)
1040 printk(KERN_ERR "%s: resubmit read urb failed. " 1053 printk(KERN_ERR "%s: resubmit read urb failed. "
1041 "(%d)", __func__, err); 1054 "(%d)", __func__, err);
1042 else 1055 else
1043 usb_mark_last_busy(port->serial->dev); 1056 usb_mark_last_busy(port->serial->dev);
1044 }
1045 1057
1046 }
1047 return; 1058 return;
1048} 1059}
1049 1060