diff options
-rw-r--r-- | drivers/usb/serial/option.c | 49 |
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 */ | 1049 | exit: |
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 | ||