aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/aircable.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/aircable.c')
-rw-r--r--drivers/usb/serial/aircable.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c
index 6d110a3bc7e7..6e320cec397d 100644
--- a/drivers/usb/serial/aircable.c
+++ b/drivers/usb/serial/aircable.c
@@ -119,9 +119,8 @@ static int aircable_probe(struct usb_serial *serial,
119 return 0; 119 return 0;
120} 120}
121 121
122static int aircable_process_packet(struct tty_struct *tty, 122static int aircable_process_packet(struct usb_serial_port *port,
123 struct usb_serial_port *port, int has_headers, 123 int has_headers, char *packet, int len)
124 char *packet, int len)
125{ 124{
126 if (has_headers) { 125 if (has_headers) {
127 len -= HCI_HEADER_LENGTH; 126 len -= HCI_HEADER_LENGTH;
@@ -132,7 +131,7 @@ static int aircable_process_packet(struct tty_struct *tty,
132 return 0; 131 return 0;
133 } 132 }
134 133
135 tty_insert_flip_string(tty, packet, len); 134 tty_insert_flip_string(&port->port, packet, len);
136 135
137 return len; 136 return len;
138} 137}
@@ -141,28 +140,22 @@ static void aircable_process_read_urb(struct urb *urb)
141{ 140{
142 struct usb_serial_port *port = urb->context; 141 struct usb_serial_port *port = urb->context;
143 char *data = (char *)urb->transfer_buffer; 142 char *data = (char *)urb->transfer_buffer;
144 struct tty_struct *tty;
145 int has_headers; 143 int has_headers;
146 int count; 144 int count;
147 int len; 145 int len;
148 int i; 146 int i;
149 147
150 tty = tty_port_tty_get(&port->port);
151 if (!tty)
152 return;
153
154 has_headers = (urb->actual_length > 2 && data[0] == RX_HEADER_0); 148 has_headers = (urb->actual_length > 2 && data[0] == RX_HEADER_0);
155 149
156 count = 0; 150 count = 0;
157 for (i = 0; i < urb->actual_length; i += HCI_COMPLETE_FRAME) { 151 for (i = 0; i < urb->actual_length; i += HCI_COMPLETE_FRAME) {
158 len = min_t(int, urb->actual_length - i, HCI_COMPLETE_FRAME); 152 len = min_t(int, urb->actual_length - i, HCI_COMPLETE_FRAME);
159 count += aircable_process_packet(tty, port, has_headers, 153 count += aircable_process_packet(port, has_headers,
160 &data[i], len); 154 &data[i], len);
161 } 155 }
162 156
163 if (count) 157 if (count)
164 tty_flip_buffer_push(tty); 158 tty_flip_buffer_push(&port->port);
165 tty_kref_put(tty);
166} 159}
167 160
168static struct usb_serial_driver aircable_device = { 161static struct usb_serial_driver aircable_device = {