aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ti_usb_3410_5052.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/ti_usb_3410_5052.c')
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 05077e3c7631..39cb9b807c3c 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -121,8 +121,8 @@ static void ti_interrupt_callback(struct urb *urb);
121static void ti_bulk_in_callback(struct urb *urb); 121static void ti_bulk_in_callback(struct urb *urb);
122static void ti_bulk_out_callback(struct urb *urb); 122static void ti_bulk_out_callback(struct urb *urb);
123 123
124static void ti_recv(struct usb_serial_port *port, struct tty_struct *tty, 124static void ti_recv(struct usb_serial_port *port, unsigned char *data,
125 unsigned char *data, int length); 125 int length);
126static void ti_send(struct ti_port *tport); 126static void ti_send(struct ti_port *tport);
127static int ti_set_mcr(struct ti_port *tport, unsigned int mcr); 127static int ti_set_mcr(struct ti_port *tport, unsigned int mcr);
128static int ti_get_lsr(struct ti_port *tport); 128static int ti_get_lsr(struct ti_port *tport);
@@ -1118,7 +1118,6 @@ static void ti_bulk_in_callback(struct urb *urb)
1118 struct device *dev = &urb->dev->dev; 1118 struct device *dev = &urb->dev->dev;
1119 int status = urb->status; 1119 int status = urb->status;
1120 int retval = 0; 1120 int retval = 0;
1121 struct tty_struct *tty;
1122 1121
1123 switch (status) { 1122 switch (status) {
1124 case 0: 1123 case 0:
@@ -1145,23 +1144,18 @@ static void ti_bulk_in_callback(struct urb *urb)
1145 return; 1144 return;
1146 } 1145 }
1147 1146
1148 tty = tty_port_tty_get(&port->port); 1147 if (urb->actual_length) {
1149 if (tty) { 1148 usb_serial_debug_data(dev, __func__, urb->actual_length,
1150 if (urb->actual_length) { 1149 urb->transfer_buffer);
1151 usb_serial_debug_data(dev, __func__, urb->actual_length,
1152 urb->transfer_buffer);
1153 1150
1154 if (!tport->tp_is_open) 1151 if (!tport->tp_is_open)
1155 dev_dbg(dev, "%s - port closed, dropping data\n", 1152 dev_dbg(dev, "%s - port closed, dropping data\n",
1156 __func__); 1153 __func__);
1157 else 1154 else
1158 ti_recv(port, tty, urb->transfer_buffer, 1155 ti_recv(port, urb->transfer_buffer, urb->actual_length);
1159 urb->actual_length); 1156 spin_lock(&tport->tp_lock);
1160 spin_lock(&tport->tp_lock); 1157 tport->tp_icount.rx += urb->actual_length;
1161 tport->tp_icount.rx += urb->actual_length; 1158 spin_unlock(&tport->tp_lock);
1162 spin_unlock(&tport->tp_lock);
1163 }
1164 tty_kref_put(tty);
1165 } 1159 }
1166 1160
1167exit: 1161exit:
@@ -1209,8 +1203,8 @@ static void ti_bulk_out_callback(struct urb *urb)
1209} 1203}
1210 1204
1211 1205
1212static void ti_recv(struct usb_serial_port *port, struct tty_struct *tty, 1206static void ti_recv(struct usb_serial_port *port, unsigned char *data,
1213 unsigned char *data, int length) 1207 int length)
1214{ 1208{
1215 int cnt; 1209 int cnt;
1216 1210
@@ -1222,11 +1216,10 @@ static void ti_recv(struct usb_serial_port *port, struct tty_struct *tty,
1222 if (cnt == 0) 1216 if (cnt == 0)
1223 break; 1217 break;
1224 } 1218 }
1225 tty_flip_buffer_push(tty); 1219 tty_flip_buffer_push(&port->port);
1226 data += cnt; 1220 data += cnt;
1227 length -= cnt; 1221 length -= cnt;
1228 } while (length > 0); 1222 } while (length > 0);
1229
1230} 1223}
1231 1224
1232 1225