diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-02 14:03:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-02 14:03:08 -0400 |
commit | 1be1d6b7f3f6e3a87f872dd5e7a867d03d8a6851 (patch) | |
tree | 102ef63f93d7d6d8400fc88158cc859a92a2b44f /drivers/usb/serial | |
parent | 37b6a04fd9fc887bbcc1a27d9354a5e7a5a4cdd8 (diff) | |
parent | 62fd2cac5bf5cf9e6fcb2fc40b32e7271e605c53 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (32 commits)
USB GADGET/PERIPHERAL: g_file_storage Bulk-Only Transport compliance, clear-feature ignore
USB GADGET/PERIPHERAL: g_file_storage Bulk-Only Transport compliance
usb_serial: some coding style fixes
USB: Remove redundant dependencies on USB_ATM.
USB: UHCI: disable remote wakeup when it's not needed
USB: OHCI: work around bogus compiler warning
USB: add Cypress c67x00 OTG controller HCD driver
USB: add Cypress c67x00 OTG controller core driver
USB: add Cypress c67x00 low level interface code
USB: airprime: unlock mutex instead of trying to lock it again
USB: storage: Update mailling list address
USB: storage: UNUSUAL_DEVS() for PanDigital Picture frame.
USB: Add the USB 2.0 extension descriptor.
USB: add more FTDI device ids
USB: fix cannot work usb storage when using ohci-sm501
usb: gadget zero timer init fix
usb: gadget zero style fixups (mostly whitespace)
usb serial gadget: CDC ACM fixes
usb: pxa27x_udc driver
USB: INTOVA Pixtreme camera mass storage device
...
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r-- | drivers/usb/serial/aircable.c | 98 | ||||
-rw-r--r-- | drivers/usb/serial/airprime.c | 63 | ||||
-rw-r--r-- | drivers/usb/serial/ark3116.c | 54 | ||||
-rw-r--r-- | drivers/usb/serial/ch341.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 8 | ||||
-rw-r--r-- | drivers/usb/serial/ftdi_sio.h | 11 | ||||
-rw-r--r-- | drivers/usb/serial/mos7840.c | 5 |
7 files changed, 134 insertions, 107 deletions
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c index 9b1bb347dc2d..db6f97a93c02 100644 --- a/drivers/usb/serial/aircable.c +++ b/drivers/usb/serial/aircable.c | |||
@@ -147,7 +147,7 @@ static void serial_buf_free(struct circ_buf *cb) | |||
147 | */ | 147 | */ |
148 | static int serial_buf_data_avail(struct circ_buf *cb) | 148 | static int serial_buf_data_avail(struct circ_buf *cb) |
149 | { | 149 | { |
150 | return CIRC_CNT(cb->head,cb->tail,AIRCABLE_BUF_SIZE); | 150 | return CIRC_CNT(cb->head, cb->tail, AIRCABLE_BUF_SIZE); |
151 | } | 151 | } |
152 | 152 | ||
153 | /* | 153 | /* |
@@ -171,7 +171,7 @@ static int serial_buf_put(struct circ_buf *cb, const char *buf, int count) | |||
171 | cb->head = (cb->head + c) & (AIRCABLE_BUF_SIZE-1); | 171 | cb->head = (cb->head + c) & (AIRCABLE_BUF_SIZE-1); |
172 | buf += c; | 172 | buf += c; |
173 | count -= c; | 173 | count -= c; |
174 | ret= c; | 174 | ret = c; |
175 | } | 175 | } |
176 | return ret; | 176 | return ret; |
177 | } | 177 | } |
@@ -197,7 +197,7 @@ static int serial_buf_get(struct circ_buf *cb, char *buf, int count) | |||
197 | cb->tail = (cb->tail + c) & (AIRCABLE_BUF_SIZE-1); | 197 | cb->tail = (cb->tail + c) & (AIRCABLE_BUF_SIZE-1); |
198 | buf += c; | 198 | buf += c; |
199 | count -= c; | 199 | count -= c; |
200 | ret= c; | 200 | ret = c; |
201 | } | 201 | } |
202 | return ret; | 202 | return ret; |
203 | } | 203 | } |
@@ -208,7 +208,7 @@ static void aircable_send(struct usb_serial_port *port) | |||
208 | { | 208 | { |
209 | int count, result; | 209 | int count, result; |
210 | struct aircable_private *priv = usb_get_serial_port_data(port); | 210 | struct aircable_private *priv = usb_get_serial_port_data(port); |
211 | unsigned char* buf; | 211 | unsigned char *buf; |
212 | __le16 *dbuf; | 212 | __le16 *dbuf; |
213 | dbg("%s - port %d", __func__, port->number); | 213 | dbg("%s - port %d", __func__, port->number); |
214 | if (port->write_urb_busy) | 214 | if (port->write_urb_busy) |
@@ -229,7 +229,8 @@ static void aircable_send(struct usb_serial_port *port) | |||
229 | buf[1] = TX_HEADER_1; | 229 | buf[1] = TX_HEADER_1; |
230 | dbuf = (__le16 *)&buf[2]; | 230 | dbuf = (__le16 *)&buf[2]; |
231 | *dbuf = cpu_to_le16((u16)count); | 231 | *dbuf = cpu_to_le16((u16)count); |
232 | serial_buf_get(priv->tx_buf,buf + HCI_HEADER_LENGTH, MAX_HCI_FRAMESIZE); | 232 | serial_buf_get(priv->tx_buf, buf + HCI_HEADER_LENGTH, |
233 | MAX_HCI_FRAMESIZE); | ||
233 | 234 | ||
234 | memcpy(port->write_urb->transfer_buffer, buf, | 235 | memcpy(port->write_urb->transfer_buffer, buf, |
235 | count + HCI_HEADER_LENGTH); | 236 | count + HCI_HEADER_LENGTH); |
@@ -261,7 +262,7 @@ static void aircable_read(struct work_struct *work) | |||
261 | struct tty_struct *tty; | 262 | struct tty_struct *tty; |
262 | unsigned char *data; | 263 | unsigned char *data; |
263 | int count; | 264 | int count; |
264 | if (priv->rx_flags & THROTTLED){ | 265 | if (priv->rx_flags & THROTTLED) { |
265 | if (priv->rx_flags & ACTUALLY_THROTTLED) | 266 | if (priv->rx_flags & ACTUALLY_THROTTLED) |
266 | schedule_work(&priv->rx_work); | 267 | schedule_work(&priv->rx_work); |
267 | return; | 268 | return; |
@@ -282,10 +283,10 @@ static void aircable_read(struct work_struct *work) | |||
282 | count = min(64, serial_buf_data_avail(priv->rx_buf)); | 283 | count = min(64, serial_buf_data_avail(priv->rx_buf)); |
283 | 284 | ||
284 | if (count <= 0) | 285 | if (count <= 0) |
285 | return; //We have finished sending everything. | 286 | return; /* We have finished sending everything. */ |
286 | 287 | ||
287 | tty_prepare_flip_string(tty, &data, count); | 288 | tty_prepare_flip_string(tty, &data, count); |
288 | if (!data){ | 289 | if (!data) { |
289 | err("%s- kzalloc(%d) failed.", __func__, count); | 290 | err("%s- kzalloc(%d) failed.", __func__, count); |
290 | return; | 291 | return; |
291 | } | 292 | } |
@@ -304,9 +305,10 @@ static void aircable_read(struct work_struct *work) | |||
304 | static int aircable_probe(struct usb_serial *serial, | 305 | static int aircable_probe(struct usb_serial *serial, |
305 | const struct usb_device_id *id) | 306 | const struct usb_device_id *id) |
306 | { | 307 | { |
307 | struct usb_host_interface *iface_desc = serial->interface->cur_altsetting; | 308 | struct usb_host_interface *iface_desc = serial->interface-> |
309 | cur_altsetting; | ||
308 | struct usb_endpoint_descriptor *endpoint; | 310 | struct usb_endpoint_descriptor *endpoint; |
309 | int num_bulk_out=0; | 311 | int num_bulk_out = 0; |
310 | int i; | 312 | int i; |
311 | 313 | ||
312 | for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { | 314 | for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { |
@@ -325,13 +327,13 @@ static int aircable_probe(struct usb_serial *serial, | |||
325 | return 0; | 327 | return 0; |
326 | } | 328 | } |
327 | 329 | ||
328 | static int aircable_attach (struct usb_serial *serial) | 330 | static int aircable_attach(struct usb_serial *serial) |
329 | { | 331 | { |
330 | struct usb_serial_port *port = serial->port[0]; | 332 | struct usb_serial_port *port = serial->port[0]; |
331 | struct aircable_private *priv; | 333 | struct aircable_private *priv; |
332 | 334 | ||
333 | priv = kzalloc(sizeof(struct aircable_private), GFP_KERNEL); | 335 | priv = kzalloc(sizeof(struct aircable_private), GFP_KERNEL); |
334 | if (!priv){ | 336 | if (!priv) { |
335 | err("%s- kmalloc(%Zd) failed.", __func__, | 337 | err("%s- kmalloc(%Zd) failed.", __func__, |
336 | sizeof(struct aircable_private)); | 338 | sizeof(struct aircable_private)); |
337 | return -ENOMEM; | 339 | return -ENOMEM; |
@@ -392,7 +394,7 @@ static int aircable_write(struct usb_serial_port *port, | |||
392 | 394 | ||
393 | usb_serial_debug_data(debug, &port->dev, __func__, count, source); | 395 | usb_serial_debug_data(debug, &port->dev, __func__, count, source); |
394 | 396 | ||
395 | if (!count){ | 397 | if (!count) { |
396 | dbg("%s - write request of 0 bytes", __func__); | 398 | dbg("%s - write request of 0 bytes", __func__); |
397 | return count; | 399 | return count; |
398 | } | 400 | } |
@@ -418,31 +420,31 @@ static void aircable_write_bulk_callback(struct urb *urb) | |||
418 | 420 | ||
419 | /* This has been taken from cypress_m8.c cypress_write_int_callback */ | 421 | /* This has been taken from cypress_m8.c cypress_write_int_callback */ |
420 | switch (status) { | 422 | switch (status) { |
421 | case 0: | 423 | case 0: |
422 | /* success */ | 424 | /* success */ |
423 | break; | 425 | break; |
424 | case -ECONNRESET: | 426 | case -ECONNRESET: |
425 | case -ENOENT: | 427 | case -ENOENT: |
426 | case -ESHUTDOWN: | 428 | case -ESHUTDOWN: |
427 | /* this urb is terminated, clean up */ | 429 | /* this urb is terminated, clean up */ |
428 | dbg("%s - urb shutting down with status: %d", | 430 | dbg("%s - urb shutting down with status: %d", |
429 | __func__, status); | 431 | __func__, status); |
430 | port->write_urb_busy = 0; | 432 | port->write_urb_busy = 0; |
433 | return; | ||
434 | default: | ||
435 | /* error in the urb, so we have to resubmit it */ | ||
436 | dbg("%s - Overflow in write", __func__); | ||
437 | dbg("%s - nonzero write bulk status received: %d", | ||
438 | __func__, status); | ||
439 | port->write_urb->transfer_buffer_length = 1; | ||
440 | port->write_urb->dev = port->serial->dev; | ||
441 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | ||
442 | if (result) | ||
443 | dev_err(&urb->dev->dev, | ||
444 | "%s - failed resubmitting write urb, error %d\n", | ||
445 | __func__, result); | ||
446 | else | ||
431 | return; | 447 | return; |
432 | default: | ||
433 | /* error in the urb, so we have to resubmit it */ | ||
434 | dbg("%s - Overflow in write", __func__); | ||
435 | dbg("%s - nonzero write bulk status received: %d", | ||
436 | __func__, status); | ||
437 | port->write_urb->transfer_buffer_length = 1; | ||
438 | port->write_urb->dev = port->serial->dev; | ||
439 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | ||
440 | if (result) | ||
441 | dev_err(&urb->dev->dev, | ||
442 | "%s - failed resubmitting write urb, error %d\n", | ||
443 | __func__, result); | ||
444 | else | ||
445 | return; | ||
446 | } | 448 | } |
447 | 449 | ||
448 | port->write_urb_busy = 0; | 450 | port->write_urb_busy = 0; |
@@ -472,11 +474,11 @@ static void aircable_read_bulk_callback(struct urb *urb) | |||
472 | dbg("%s - caught -EPROTO, resubmitting the urb", | 474 | dbg("%s - caught -EPROTO, resubmitting the urb", |
473 | __func__); | 475 | __func__); |
474 | usb_fill_bulk_urb(port->read_urb, port->serial->dev, | 476 | usb_fill_bulk_urb(port->read_urb, port->serial->dev, |
475 | usb_rcvbulkpipe(port->serial->dev, | 477 | usb_rcvbulkpipe(port->serial->dev, |
476 | port->bulk_in_endpointAddress), | 478 | port->bulk_in_endpointAddress), |
477 | port->read_urb->transfer_buffer, | 479 | port->read_urb->transfer_buffer, |
478 | port->read_urb->transfer_buffer_length, | 480 | port->read_urb->transfer_buffer_length, |
479 | aircable_read_bulk_callback, port); | 481 | aircable_read_bulk_callback, port); |
480 | 482 | ||
481 | result = usb_submit_urb(urb, GFP_ATOMIC); | 483 | result = usb_submit_urb(urb, GFP_ATOMIC); |
482 | if (result) | 484 | if (result) |
@@ -490,7 +492,7 @@ static void aircable_read_bulk_callback(struct urb *urb) | |||
490 | } | 492 | } |
491 | 493 | ||
492 | usb_serial_debug_data(debug, &port->dev, __func__, | 494 | usb_serial_debug_data(debug, &port->dev, __func__, |
493 | urb->actual_length,urb->transfer_buffer); | 495 | urb->actual_length, urb->transfer_buffer); |
494 | 496 | ||
495 | tty = port->tty; | 497 | tty = port->tty; |
496 | if (tty && urb->actual_length) { | 498 | if (tty && urb->actual_length) { |
@@ -507,9 +509,9 @@ static void aircable_read_bulk_callback(struct urb *urb) | |||
507 | no_packages = urb->actual_length / (HCI_COMPLETE_FRAME); | 509 | no_packages = urb->actual_length / (HCI_COMPLETE_FRAME); |
508 | 510 | ||
509 | if (urb->actual_length % HCI_COMPLETE_FRAME != 0) | 511 | if (urb->actual_length % HCI_COMPLETE_FRAME != 0) |
510 | no_packages+=1; | 512 | no_packages++; |
511 | 513 | ||
512 | for (i = 0; i < no_packages ;i++) { | 514 | for (i = 0; i < no_packages; i++) { |
513 | if (remaining > (HCI_COMPLETE_FRAME)) | 515 | if (remaining > (HCI_COMPLETE_FRAME)) |
514 | package_length = HCI_COMPLETE_FRAME; | 516 | package_length = HCI_COMPLETE_FRAME; |
515 | else | 517 | else |
@@ -529,7 +531,7 @@ static void aircable_read_bulk_callback(struct urb *urb) | |||
529 | if (port->open_count) { | 531 | if (port->open_count) { |
530 | usb_fill_bulk_urb(port->read_urb, port->serial->dev, | 532 | usb_fill_bulk_urb(port->read_urb, port->serial->dev, |
531 | usb_rcvbulkpipe(port->serial->dev, | 533 | usb_rcvbulkpipe(port->serial->dev, |
532 | port->bulk_in_endpointAddress), | 534 | port->bulk_in_endpointAddress), |
533 | port->read_urb->transfer_buffer, | 535 | port->read_urb->transfer_buffer, |
534 | port->read_urb->transfer_buffer_length, | 536 | port->read_urb->transfer_buffer_length, |
535 | aircable_read_bulk_callback, port); | 537 | aircable_read_bulk_callback, port); |
@@ -602,7 +604,7 @@ static struct usb_serial_driver aircable_device = { | |||
602 | .unthrottle = aircable_unthrottle, | 604 | .unthrottle = aircable_unthrottle, |
603 | }; | 605 | }; |
604 | 606 | ||
605 | static int __init aircable_init (void) | 607 | static int __init aircable_init(void) |
606 | { | 608 | { |
607 | int retval; | 609 | int retval; |
608 | retval = usb_serial_register(&aircable_device); | 610 | retval = usb_serial_register(&aircable_device); |
@@ -619,7 +621,7 @@ failed_usb_register: | |||
619 | return retval; | 621 | return retval; |
620 | } | 622 | } |
621 | 623 | ||
622 | static void __exit aircable_exit (void) | 624 | static void __exit aircable_exit(void) |
623 | { | 625 | { |
624 | usb_deregister(&aircable_driver); | 626 | usb_deregister(&aircable_driver); |
625 | usb_serial_deregister(&aircable_device); | 627 | usb_serial_deregister(&aircable_device); |
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c index 725b6b94c274..0798c14ce787 100644 --- a/drivers/usb/serial/airprime.c +++ b/drivers/usb/serial/airprime.c | |||
@@ -68,8 +68,9 @@ static int airprime_send_setup(struct usb_serial_port *port) | |||
68 | val |= 0x02; | 68 | val |= 0x02; |
69 | 69 | ||
70 | return usb_control_msg(serial->dev, | 70 | return usb_control_msg(serial->dev, |
71 | usb_rcvctrlpipe(serial->dev, 0), | 71 | usb_rcvctrlpipe(serial->dev, 0), |
72 | 0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT); | 72 | 0x22, 0x21, val, 0, NULL, 0, |
73 | USB_CTRL_SET_TIMEOUT); | ||
73 | } | 74 | } |
74 | 75 | ||
75 | return 0; | 76 | return 0; |
@@ -90,17 +91,19 @@ static void airprime_read_bulk_callback(struct urb *urb) | |||
90 | __func__, status); | 91 | __func__, status); |
91 | return; | 92 | return; |
92 | } | 93 | } |
93 | usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); | 94 | usb_serial_debug_data(debug, &port->dev, __func__, |
95 | urb->actual_length, data); | ||
94 | 96 | ||
95 | tty = port->tty; | 97 | tty = port->tty; |
96 | if (tty && urb->actual_length) { | 98 | if (tty && urb->actual_length) { |
97 | tty_insert_flip_string (tty, data, urb->actual_length); | 99 | tty_insert_flip_string(tty, data, urb->actual_length); |
98 | tty_flip_buffer_push (tty); | 100 | tty_flip_buffer_push(tty); |
99 | } | 101 | } |
100 | 102 | ||
101 | result = usb_submit_urb (urb, GFP_ATOMIC); | 103 | result = usb_submit_urb(urb, GFP_ATOMIC); |
102 | if (result) | 104 | if (result) |
103 | dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", | 105 | dev_err(&port->dev, |
106 | "%s - failed resubmitting read urb, error %d\n", | ||
104 | __func__, result); | 107 | __func__, result); |
105 | return; | 108 | return; |
106 | } | 109 | } |
@@ -115,7 +118,7 @@ static void airprime_write_bulk_callback(struct urb *urb) | |||
115 | dbg("%s - port %d", __func__, port->number); | 118 | dbg("%s - port %d", __func__, port->number); |
116 | 119 | ||
117 | /* free up the transfer buffer, as usb_free_urb() does not do this */ | 120 | /* free up the transfer buffer, as usb_free_urb() does not do this */ |
118 | kfree (urb->transfer_buffer); | 121 | kfree(urb->transfer_buffer); |
119 | 122 | ||
120 | if (status) | 123 | if (status) |
121 | dbg("%s - nonzero write bulk status received: %d", | 124 | dbg("%s - nonzero write bulk status received: %d", |
@@ -171,7 +174,7 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp) | |||
171 | } | 174 | } |
172 | usb_fill_bulk_urb(urb, serial->dev, | 175 | usb_fill_bulk_urb(urb, serial->dev, |
173 | usb_rcvbulkpipe(serial->dev, | 176 | usb_rcvbulkpipe(serial->dev, |
174 | port->bulk_out_endpointAddress), | 177 | port->bulk_out_endpointAddress), |
175 | buffer, buffer_size, | 178 | buffer, buffer_size, |
176 | airprime_read_bulk_callback, port); | 179 | airprime_read_bulk_callback, port); |
177 | result = usb_submit_urb(urb, GFP_KERNEL); | 180 | result = usb_submit_urb(urb, GFP_KERNEL); |
@@ -183,7 +186,8 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp) | |||
183 | __func__, i, port->number, result); | 186 | __func__, i, port->number, result); |
184 | goto errout; | 187 | goto errout; |
185 | } | 188 | } |
186 | /* remember this urb so we can kill it when the port is closed */ | 189 | /* remember this urb so we can kill it when the |
190 | port is closed */ | ||
187 | priv->read_urbp[i] = urb; | 191 | priv->read_urbp[i] = urb; |
188 | } | 192 | } |
189 | 193 | ||
@@ -192,22 +196,22 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp) | |||
192 | goto out; | 196 | goto out; |
193 | 197 | ||
194 | errout: | 198 | errout: |
195 | /* some error happened, cancel any submitted urbs and clean up anything that | 199 | /* some error happened, cancel any submitted urbs and clean up |
196 | got allocated successfully */ | 200 | anything that got allocated successfully */ |
197 | 201 | ||
198 | while (i-- != 0) { | 202 | while (i-- != 0) { |
199 | urb = priv->read_urbp[i]; | 203 | urb = priv->read_urbp[i]; |
200 | buffer = urb->transfer_buffer; | 204 | buffer = urb->transfer_buffer; |
201 | usb_kill_urb (urb); | 205 | usb_kill_urb(urb); |
202 | usb_free_urb (urb); | 206 | usb_free_urb(urb); |
203 | kfree (buffer); | 207 | kfree(buffer); |
204 | } | 208 | } |
205 | 209 | ||
206 | out: | 210 | out: |
207 | return result; | 211 | return result; |
208 | } | 212 | } |
209 | 213 | ||
210 | static void airprime_close(struct usb_serial_port *port, struct file * filp) | 214 | static void airprime_close(struct usb_serial_port *port, struct file *filp) |
211 | { | 215 | { |
212 | struct airprime_private *priv = usb_get_serial_port_data(port); | 216 | struct airprime_private *priv = usb_get_serial_port_data(port); |
213 | int i; | 217 | int i; |
@@ -220,16 +224,16 @@ static void airprime_close(struct usb_serial_port *port, struct file * filp) | |||
220 | mutex_lock(&port->serial->disc_mutex); | 224 | mutex_lock(&port->serial->disc_mutex); |
221 | if (!port->serial->disconnected) | 225 | if (!port->serial->disconnected) |
222 | airprime_send_setup(port); | 226 | airprime_send_setup(port); |
223 | mutex_lock(&port->serial->disc_mutex); | 227 | mutex_unlock(&port->serial->disc_mutex); |
224 | 228 | ||
225 | for (i = 0; i < NUM_READ_URBS; ++i) { | 229 | for (i = 0; i < NUM_READ_URBS; ++i) { |
226 | usb_kill_urb (priv->read_urbp[i]); | 230 | usb_kill_urb(priv->read_urbp[i]); |
227 | kfree (priv->read_urbp[i]->transfer_buffer); | 231 | kfree(priv->read_urbp[i]->transfer_buffer); |
228 | usb_free_urb (priv->read_urbp[i]); | 232 | usb_free_urb(priv->read_urbp[i]); |
229 | } | 233 | } |
230 | 234 | ||
231 | /* free up private structure */ | 235 | /* free up private structure */ |
232 | kfree (priv); | 236 | kfree(priv); |
233 | usb_set_serial_port_data(port, NULL); | 237 | usb_set_serial_port_data(port, NULL); |
234 | } | 238 | } |
235 | 239 | ||
@@ -259,10 +263,10 @@ static int airprime_write(struct usb_serial_port *port, | |||
259 | urb = usb_alloc_urb(0, GFP_ATOMIC); | 263 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
260 | if (!urb) { | 264 | if (!urb) { |
261 | dev_err(&port->dev, "no more free urbs\n"); | 265 | dev_err(&port->dev, "no more free urbs\n"); |
262 | kfree (buffer); | 266 | kfree(buffer); |
263 | return -ENOMEM; | 267 | return -ENOMEM; |
264 | } | 268 | } |
265 | memcpy (buffer, buf, count); | 269 | memcpy(buffer, buf, count); |
266 | 270 | ||
267 | usb_serial_debug_data(debug, &port->dev, __func__, count, buffer); | 271 | usb_serial_debug_data(debug, &port->dev, __func__, count, buffer); |
268 | 272 | ||
@@ -279,7 +283,7 @@ static int airprime_write(struct usb_serial_port *port, | |||
279 | "%s - usb_submit_urb(write bulk) failed with status = %d\n", | 283 | "%s - usb_submit_urb(write bulk) failed with status = %d\n", |
280 | __func__, status); | 284 | __func__, status); |
281 | count = status; | 285 | count = status; |
282 | kfree (buffer); | 286 | kfree(buffer); |
283 | } else { | 287 | } else { |
284 | spin_lock_irqsave(&priv->lock, flags); | 288 | spin_lock_irqsave(&priv->lock, flags); |
285 | ++priv->outstanding_urbs; | 289 | ++priv->outstanding_urbs; |
@@ -287,7 +291,7 @@ static int airprime_write(struct usb_serial_port *port, | |||
287 | } | 291 | } |
288 | /* we are done with this urb, so let the host driver | 292 | /* we are done with this urb, so let the host driver |
289 | * really free it when it is finished with it */ | 293 | * really free it when it is finished with it */ |
290 | usb_free_urb (urb); | 294 | usb_free_urb(urb); |
291 | return count; | 295 | return count; |
292 | } | 296 | } |
293 | 297 | ||
@@ -315,8 +319,10 @@ static int __init airprime_init(void) | |||
315 | { | 319 | { |
316 | int retval; | 320 | int retval; |
317 | 321 | ||
318 | airprime_device.num_ports = | 322 | airprime_device.num_ports = endpoints; |
319 | (endpoints > 0 && endpoints <= MAX_BULK_EPS) ? endpoints : NUM_BULK_EPS; | 323 | if (endpoints < 0 || endpoints >= MAX_BULK_EPS) |
324 | airprime_device.num_ports = NUM_BULK_EPS; | ||
325 | |||
320 | retval = usb_serial_register(&airprime_device); | 326 | retval = usb_serial_register(&airprime_device); |
321 | if (retval) | 327 | if (retval) |
322 | return retval; | 328 | return retval; |
@@ -341,6 +347,7 @@ MODULE_LICENSE("GPL"); | |||
341 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 347 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
342 | MODULE_PARM_DESC(debug, "Debug enabled"); | 348 | MODULE_PARM_DESC(debug, "Debug enabled"); |
343 | module_param(buffer_size, int, 0); | 349 | module_param(buffer_size, int, 0); |
344 | MODULE_PARM_DESC(buffer_size, "Size of the transfer buffers in bytes (default 4096)"); | 350 | MODULE_PARM_DESC(buffer_size, |
351 | "Size of the transfer buffers in bytes (default 4096)"); | ||
345 | module_param(endpoints, int, 0); | 352 | module_param(endpoints, int, 0); |
346 | MODULE_PARM_DESC(endpoints, "Number of bulk EPs to configure (default 3)"); | 353 | MODULE_PARM_DESC(endpoints, "Number of bulk EPs to configure (default 3)"); |
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 599ab2e548a7..77895c8f8f31 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/usb.h> | 24 | #include <linux/usb.h> |
25 | #include <linux/usb/serial.h> | 25 | #include <linux/usb/serial.h> |
26 | #include <linux/serial.h> | 26 | #include <linux/serial.h> |
27 | #include <asm/uaccess.h> | 27 | #include <linux/uaccess.h> |
28 | 28 | ||
29 | 29 | ||
30 | static int debug; | 30 | static int debug; |
@@ -246,29 +246,29 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
246 | baud = tty_get_baud_rate(port->tty); | 246 | baud = tty_get_baud_rate(port->tty); |
247 | 247 | ||
248 | switch (baud) { | 248 | switch (baud) { |
249 | case 75: | 249 | case 75: |
250 | case 150: | 250 | case 150: |
251 | case 300: | 251 | case 300: |
252 | case 600: | 252 | case 600: |
253 | case 1200: | 253 | case 1200: |
254 | case 1800: | 254 | case 1800: |
255 | case 2400: | 255 | case 2400: |
256 | case 4800: | 256 | case 4800: |
257 | case 9600: | 257 | case 9600: |
258 | case 19200: | 258 | case 19200: |
259 | case 38400: | 259 | case 38400: |
260 | case 57600: | 260 | case 57600: |
261 | case 115200: | 261 | case 115200: |
262 | case 230400: | 262 | case 230400: |
263 | case 460800: | 263 | case 460800: |
264 | /* Report the resulting rate back to the caller */ | 264 | /* Report the resulting rate back to the caller */ |
265 | tty_encode_baud_rate(port->tty, baud, baud); | 265 | tty_encode_baud_rate(port->tty, baud, baud); |
266 | break; | 266 | break; |
267 | /* set 9600 as default (if given baudrate is invalid for example) */ | 267 | /* set 9600 as default (if given baudrate is invalid for example) */ |
268 | default: | 268 | default: |
269 | tty_encode_baud_rate(port->tty, 9600, 9600); | 269 | tty_encode_baud_rate(port->tty, 9600, 9600); |
270 | case 0: | 270 | case 0: |
271 | baud = 9600; | 271 | baud = 9600; |
272 | } | 272 | } |
273 | 273 | ||
274 | /* | 274 | /* |
@@ -380,19 +380,19 @@ static int ark3116_ioctl(struct usb_serial_port *port, struct file *file, | |||
380 | switch (cmd) { | 380 | switch (cmd) { |
381 | case TIOCGSERIAL: | 381 | case TIOCGSERIAL: |
382 | /* XXX: Some of these values are probably wrong. */ | 382 | /* XXX: Some of these values are probably wrong. */ |
383 | memset(&serstruct, 0, sizeof (serstruct)); | 383 | memset(&serstruct, 0, sizeof(serstruct)); |
384 | serstruct.type = PORT_16654; | 384 | serstruct.type = PORT_16654; |
385 | serstruct.line = port->serial->minor; | 385 | serstruct.line = port->serial->minor; |
386 | serstruct.port = port->number; | 386 | serstruct.port = port->number; |
387 | serstruct.custom_divisor = 0; | 387 | serstruct.custom_divisor = 0; |
388 | serstruct.baud_base = 460800; | 388 | serstruct.baud_base = 460800; |
389 | 389 | ||
390 | if (copy_to_user(user_arg, &serstruct, sizeof (serstruct))) | 390 | if (copy_to_user(user_arg, &serstruct, sizeof(serstruct))) |
391 | return -EFAULT; | 391 | return -EFAULT; |
392 | 392 | ||
393 | return 0; | 393 | return 0; |
394 | case TIOCSSERIAL: | 394 | case TIOCSSERIAL: |
395 | if (copy_from_user(&serstruct, user_arg, sizeof (serstruct))) | 395 | if (copy_from_user(&serstruct, user_arg, sizeof(serstruct))) |
396 | return -EFAULT; | 396 | return -EFAULT; |
397 | return 0; | 397 | return 0; |
398 | default: | 398 | default: |
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index d947d955bceb..ba28fdc9ccd2 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -130,7 +130,7 @@ static int ch341_get_status(struct usb_device *dev) | |||
130 | return -ENOMEM; | 130 | return -ENOMEM; |
131 | 131 | ||
132 | r = ch341_control_in(dev, 0x95, 0x0706, 0, buffer, size); | 132 | r = ch341_control_in(dev, 0x95, 0x0706, 0, buffer, size); |
133 | if ( r < 0) | 133 | if (r < 0) |
134 | goto out; | 134 | goto out; |
135 | 135 | ||
136 | /* Not having the datasheet for the CH341, we ignore the bytes returned | 136 | /* Not having the datasheet for the CH341, we ignore the bytes returned |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index c7329f43d9c9..5b349ece7247 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -133,6 +133,14 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { | |||
133 | static struct usb_device_id id_table_combined [] = { | 133 | static struct usb_device_id id_table_combined [] = { |
134 | { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, | 134 | { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, |
135 | { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, | 135 | { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, |
136 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) }, | ||
137 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_1_PID) }, | ||
138 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_2_PID) }, | ||
139 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_3_PID) }, | ||
140 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_4_PID) }, | ||
141 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_5_PID) }, | ||
142 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_6_PID) }, | ||
143 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_7_PID) }, | ||
136 | { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) }, | 144 | { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) }, |
137 | { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, | 145 | { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, |
138 | { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) }, | 146 | { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 6da539ede0ee..504edf8c3a3f 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -40,6 +40,17 @@ | |||
40 | /* AlphaMicro Components AMC-232USB01 device */ | 40 | /* AlphaMicro Components AMC-232USB01 device */ |
41 | #define FTDI_AMC232_PID 0xFF00 /* Product Id */ | 41 | #define FTDI_AMC232_PID 0xFF00 /* Product Id */ |
42 | 42 | ||
43 | /* SCS HF Radio Modems PID's (http://www.scs-ptc.com) */ | ||
44 | /* the VID is the standard ftdi vid (FTDI_VID) */ | ||
45 | #define FTDI_SCS_DEVICE_0_PID 0xD010 /* SCS PTC-IIusb */ | ||
46 | #define FTDI_SCS_DEVICE_1_PID 0xD011 /* SCS Tracker / DSP TNC */ | ||
47 | #define FTDI_SCS_DEVICE_2_PID 0xD012 | ||
48 | #define FTDI_SCS_DEVICE_3_PID 0xD013 | ||
49 | #define FTDI_SCS_DEVICE_4_PID 0xD014 | ||
50 | #define FTDI_SCS_DEVICE_5_PID 0xD015 | ||
51 | #define FTDI_SCS_DEVICE_6_PID 0xD016 | ||
52 | #define FTDI_SCS_DEVICE_7_PID 0xD017 | ||
53 | |||
43 | /* ACT Solutions HomePro ZWave interface (http://www.act-solutions.com/HomePro.htm) */ | 54 | /* ACT Solutions HomePro ZWave interface (http://www.act-solutions.com/HomePro.htm) */ |
44 | #define FTDI_ACTZWAVE_PID 0xF2D0 | 55 | #define FTDI_ACTZWAVE_PID 0xF2D0 |
45 | 56 | ||
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 6bcb82d3911a..78f2f6db494d 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -1713,7 +1713,7 @@ static int mos7840_tiocmset(struct usb_serial_port *port, struct file *file, | |||
1713 | { | 1713 | { |
1714 | struct moschip_port *mos7840_port; | 1714 | struct moschip_port *mos7840_port; |
1715 | unsigned int mcr; | 1715 | unsigned int mcr; |
1716 | unsigned int status; | 1716 | int status; |
1717 | 1717 | ||
1718 | dbg("%s - port %d", __func__, port->number); | 1718 | dbg("%s - port %d", __func__, port->number); |
1719 | 1719 | ||
@@ -1740,11 +1740,10 @@ static int mos7840_tiocmset(struct usb_serial_port *port, struct file *file, | |||
1740 | 1740 | ||
1741 | mos7840_port->shadowMCR = mcr; | 1741 | mos7840_port->shadowMCR = mcr; |
1742 | 1742 | ||
1743 | status = 0; | ||
1744 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, mcr); | 1743 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, mcr); |
1745 | if (status < 0) { | 1744 | if (status < 0) { |
1746 | dbg("setting MODEM_CONTROL_REGISTER Failed\n"); | 1745 | dbg("setting MODEM_CONTROL_REGISTER Failed\n"); |
1747 | return -1; | 1746 | return status; |
1748 | } | 1747 | } |
1749 | 1748 | ||
1750 | return 0; | 1749 | return 0; |