diff options
Diffstat (limited to 'drivers/usb')
107 files changed, 869 insertions, 2341 deletions
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index 75eca7645227..53a7bc07dd8d 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | obj-$(CONFIG_USB) += core/ | 7 | obj-$(CONFIG_USB) += core/ |
8 | 8 | ||
9 | obj-$(CONFIG_USB_OTG_UTILS) += otg/ | ||
10 | |||
9 | obj-$(CONFIG_USB_DWC3) += dwc3/ | 11 | obj-$(CONFIG_USB_DWC3) += dwc3/ |
10 | 12 | ||
11 | obj-$(CONFIG_USB_MON) += mon/ | 13 | obj-$(CONFIG_USB_MON) += mon/ |
@@ -51,7 +53,6 @@ obj-$(CONFIG_USB_SPEEDTOUCH) += atm/ | |||
51 | 53 | ||
52 | obj-$(CONFIG_USB_MUSB_HDRC) += musb/ | 54 | obj-$(CONFIG_USB_MUSB_HDRC) += musb/ |
53 | obj-$(CONFIG_USB_RENESAS_USBHS) += renesas_usbhs/ | 55 | obj-$(CONFIG_USB_RENESAS_USBHS) += renesas_usbhs/ |
54 | obj-$(CONFIG_USB_OTG_UTILS) += otg/ | ||
55 | obj-$(CONFIG_USB_GADGET) += gadget/ | 56 | obj-$(CONFIG_USB_GADGET) += gadget/ |
56 | 57 | ||
57 | obj-$(CONFIG_USB_COMMON) += usb-common.o | 58 | obj-$(CONFIG_USB_COMMON) += usb-common.o |
diff --git a/drivers/usb/c67x00/c67x00-drv.c b/drivers/usb/c67x00/c67x00-drv.c index 57ae44cd0b88..6f3b6e267398 100644 --- a/drivers/usb/c67x00/c67x00-drv.c +++ b/drivers/usb/c67x00/c67x00-drv.c | |||
@@ -225,21 +225,10 @@ static struct platform_driver c67x00_driver = { | |||
225 | .name = "c67x00", | 225 | .name = "c67x00", |
226 | }, | 226 | }, |
227 | }; | 227 | }; |
228 | MODULE_ALIAS("platform:c67x00"); | ||
229 | |||
230 | static int __init c67x00_init(void) | ||
231 | { | ||
232 | return platform_driver_register(&c67x00_driver); | ||
233 | } | ||
234 | 228 | ||
235 | static void __exit c67x00_exit(void) | 229 | module_platform_driver(c67x00_driver); |
236 | { | ||
237 | platform_driver_unregister(&c67x00_driver); | ||
238 | } | ||
239 | |||
240 | module_init(c67x00_init); | ||
241 | module_exit(c67x00_exit); | ||
242 | 230 | ||
243 | MODULE_AUTHOR("Peter Korsgaard, Jan Veldeman, Grant Likely"); | 231 | MODULE_AUTHOR("Peter Korsgaard, Jan Veldeman, Grant Likely"); |
244 | MODULE_DESCRIPTION("Cypress C67X00 USB Controller Driver"); | 232 | MODULE_DESCRIPTION("Cypress C67X00 USB Controller Driver"); |
245 | MODULE_LICENSE("GPL"); | 233 | MODULE_LICENSE("GPL"); |
234 | MODULE_ALIAS("platform:c67x00"); | ||
diff --git a/drivers/usb/c67x00/c67x00-hcd.c b/drivers/usb/c67x00/c67x00-hcd.c index d3e1356d091e..75e47b860a53 100644 --- a/drivers/usb/c67x00/c67x00-hcd.c +++ b/drivers/usb/c67x00/c67x00-hcd.c | |||
@@ -271,7 +271,6 @@ static void c67x00_hcd_irq(struct c67x00_sie *sie, u16 int_status, u16 msg) | |||
271 | if (int_status & SOFEOP_FLG(sie->sie_num)) { | 271 | if (int_status & SOFEOP_FLG(sie->sie_num)) { |
272 | c67x00_ll_usb_clear_status(sie, SOF_EOP_IRQ_FLG); | 272 | c67x00_ll_usb_clear_status(sie, SOF_EOP_IRQ_FLG); |
273 | c67x00_sched_kick(c67x00); | 273 | c67x00_sched_kick(c67x00); |
274 | set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); | ||
275 | } | 274 | } |
276 | } | 275 | } |
277 | 276 | ||
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e8c564a53346..d9d9340abe60 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -58,12 +58,62 @@ static struct usb_driver acm_driver; | |||
58 | static struct tty_driver *acm_tty_driver; | 58 | static struct tty_driver *acm_tty_driver; |
59 | static struct acm *acm_table[ACM_TTY_MINORS]; | 59 | static struct acm *acm_table[ACM_TTY_MINORS]; |
60 | 60 | ||
61 | static DEFINE_MUTEX(open_mutex); | 61 | static DEFINE_MUTEX(acm_table_lock); |
62 | 62 | ||
63 | #define ACM_READY(acm) (acm && acm->dev && acm->port.count) | 63 | /* |
64 | * acm_table accessors | ||
65 | */ | ||
64 | 66 | ||
65 | static const struct tty_port_operations acm_port_ops = { | 67 | /* |
66 | }; | 68 | * Look up an ACM structure by index. If found and not disconnected, increment |
69 | * its refcount and return it with its mutex held. | ||
70 | */ | ||
71 | static struct acm *acm_get_by_index(unsigned index) | ||
72 | { | ||
73 | struct acm *acm; | ||
74 | |||
75 | mutex_lock(&acm_table_lock); | ||
76 | acm = acm_table[index]; | ||
77 | if (acm) { | ||
78 | mutex_lock(&acm->mutex); | ||
79 | if (acm->disconnected) { | ||
80 | mutex_unlock(&acm->mutex); | ||
81 | acm = NULL; | ||
82 | } else { | ||
83 | tty_port_get(&acm->port); | ||
84 | mutex_unlock(&acm->mutex); | ||
85 | } | ||
86 | } | ||
87 | mutex_unlock(&acm_table_lock); | ||
88 | return acm; | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * Try to find an available minor number and if found, associate it with 'acm'. | ||
93 | */ | ||
94 | static int acm_alloc_minor(struct acm *acm) | ||
95 | { | ||
96 | int minor; | ||
97 | |||
98 | mutex_lock(&acm_table_lock); | ||
99 | for (minor = 0; minor < ACM_TTY_MINORS; minor++) { | ||
100 | if (!acm_table[minor]) { | ||
101 | acm_table[minor] = acm; | ||
102 | break; | ||
103 | } | ||
104 | } | ||
105 | mutex_unlock(&acm_table_lock); | ||
106 | |||
107 | return minor; | ||
108 | } | ||
109 | |||
110 | /* Release the minor number associated with 'acm'. */ | ||
111 | static void acm_release_minor(struct acm *acm) | ||
112 | { | ||
113 | mutex_lock(&acm_table_lock); | ||
114 | acm_table[acm->minor] = NULL; | ||
115 | mutex_unlock(&acm_table_lock); | ||
116 | } | ||
67 | 117 | ||
68 | /* | 118 | /* |
69 | * Functions for ACM control messages. | 119 | * Functions for ACM control messages. |
@@ -267,9 +317,6 @@ static void acm_ctrl_irq(struct urb *urb) | |||
267 | goto exit; | 317 | goto exit; |
268 | } | 318 | } |
269 | 319 | ||
270 | if (!ACM_READY(acm)) | ||
271 | goto exit; | ||
272 | |||
273 | usb_mark_last_busy(acm->dev); | 320 | usb_mark_last_busy(acm->dev); |
274 | 321 | ||
275 | data = (unsigned char *)(dr + 1); | 322 | data = (unsigned char *)(dr + 1); |
@@ -429,8 +476,7 @@ static void acm_write_bulk(struct urb *urb) | |||
429 | spin_lock_irqsave(&acm->write_lock, flags); | 476 | spin_lock_irqsave(&acm->write_lock, flags); |
430 | acm_write_done(acm, wb); | 477 | acm_write_done(acm, wb); |
431 | spin_unlock_irqrestore(&acm->write_lock, flags); | 478 | spin_unlock_irqrestore(&acm->write_lock, flags); |
432 | if (ACM_READY(acm)) | 479 | schedule_work(&acm->work); |
433 | schedule_work(&acm->work); | ||
434 | } | 480 | } |
435 | 481 | ||
436 | static void acm_softint(struct work_struct *work) | 482 | static void acm_softint(struct work_struct *work) |
@@ -440,8 +486,6 @@ static void acm_softint(struct work_struct *work) | |||
440 | 486 | ||
441 | dev_vdbg(&acm->data->dev, "%s\n", __func__); | 487 | dev_vdbg(&acm->data->dev, "%s\n", __func__); |
442 | 488 | ||
443 | if (!ACM_READY(acm)) | ||
444 | return; | ||
445 | tty = tty_port_tty_get(&acm->port); | 489 | tty = tty_port_tty_get(&acm->port); |
446 | if (!tty) | 490 | if (!tty) |
447 | return; | 491 | return; |
@@ -453,93 +497,122 @@ static void acm_softint(struct work_struct *work) | |||
453 | * TTY handlers | 497 | * TTY handlers |
454 | */ | 498 | */ |
455 | 499 | ||
456 | static int acm_tty_open(struct tty_struct *tty, struct file *filp) | 500 | static int acm_tty_install(struct tty_driver *driver, struct tty_struct *tty) |
457 | { | 501 | { |
458 | struct acm *acm; | 502 | struct acm *acm; |
459 | int rv = -ENODEV; | 503 | int retval; |
460 | |||
461 | mutex_lock(&open_mutex); | ||
462 | 504 | ||
463 | acm = acm_table[tty->index]; | 505 | dev_dbg(tty->dev, "%s\n", __func__); |
464 | if (!acm || !acm->dev) | ||
465 | goto out; | ||
466 | else | ||
467 | rv = 0; | ||
468 | 506 | ||
469 | dev_dbg(&acm->control->dev, "%s\n", __func__); | 507 | acm = acm_get_by_index(tty->index); |
508 | if (!acm) | ||
509 | return -ENODEV; | ||
470 | 510 | ||
471 | set_bit(TTY_NO_WRITE_SPLIT, &tty->flags); | 511 | retval = tty_init_termios(tty); |
512 | if (retval) | ||
513 | goto error_init_termios; | ||
472 | 514 | ||
473 | tty->driver_data = acm; | 515 | tty->driver_data = acm; |
474 | tty_port_tty_set(&acm->port, tty); | ||
475 | 516 | ||
476 | if (usb_autopm_get_interface(acm->control) < 0) | 517 | /* Final install (we use the default method) */ |
477 | goto early_bail; | 518 | tty_driver_kref_get(driver); |
478 | else | 519 | tty->count++; |
479 | acm->control->needs_remote_wakeup = 1; | 520 | driver->ttys[tty->index] = tty; |
521 | |||
522 | return 0; | ||
523 | |||
524 | error_init_termios: | ||
525 | tty_port_put(&acm->port); | ||
526 | return retval; | ||
527 | } | ||
528 | |||
529 | static int acm_tty_open(struct tty_struct *tty, struct file *filp) | ||
530 | { | ||
531 | struct acm *acm = tty->driver_data; | ||
532 | |||
533 | dev_dbg(tty->dev, "%s\n", __func__); | ||
534 | |||
535 | return tty_port_open(&acm->port, tty, filp); | ||
536 | } | ||
537 | |||
538 | static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) | ||
539 | { | ||
540 | struct acm *acm = container_of(port, struct acm, port); | ||
541 | int retval = -ENODEV; | ||
542 | |||
543 | dev_dbg(&acm->control->dev, "%s\n", __func__); | ||
480 | 544 | ||
481 | mutex_lock(&acm->mutex); | 545 | mutex_lock(&acm->mutex); |
482 | if (acm->port.count++) { | 546 | if (acm->disconnected) |
483 | mutex_unlock(&acm->mutex); | 547 | goto disconnected; |
484 | usb_autopm_put_interface(acm->control); | 548 | |
485 | goto out; | 549 | retval = usb_autopm_get_interface(acm->control); |
486 | } | 550 | if (retval) |
551 | goto error_get_interface; | ||
552 | |||
553 | /* | ||
554 | * FIXME: Why do we need this? Allocating 64K of physically contiguous | ||
555 | * memory is really nasty... | ||
556 | */ | ||
557 | set_bit(TTY_NO_WRITE_SPLIT, &tty->flags); | ||
558 | acm->control->needs_remote_wakeup = 1; | ||
487 | 559 | ||
488 | acm->ctrlurb->dev = acm->dev; | 560 | acm->ctrlurb->dev = acm->dev; |
489 | if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL)) { | 561 | if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL)) { |
490 | dev_err(&acm->control->dev, | 562 | dev_err(&acm->control->dev, |
491 | "%s - usb_submit_urb(ctrl irq) failed\n", __func__); | 563 | "%s - usb_submit_urb(ctrl irq) failed\n", __func__); |
492 | goto bail_out; | 564 | goto error_submit_urb; |
493 | } | 565 | } |
494 | 566 | ||
495 | if (0 > acm_set_control(acm, acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS) && | 567 | acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS; |
568 | if (acm_set_control(acm, acm->ctrlout) < 0 && | ||
496 | (acm->ctrl_caps & USB_CDC_CAP_LINE)) | 569 | (acm->ctrl_caps & USB_CDC_CAP_LINE)) |
497 | goto bail_out; | 570 | goto error_set_control; |
498 | 571 | ||
499 | usb_autopm_put_interface(acm->control); | 572 | usb_autopm_put_interface(acm->control); |
500 | 573 | ||
501 | if (acm_submit_read_urbs(acm, GFP_KERNEL)) | 574 | if (acm_submit_read_urbs(acm, GFP_KERNEL)) |
502 | goto bail_out; | 575 | goto error_submit_read_urbs; |
503 | |||
504 | set_bit(ASYNCB_INITIALIZED, &acm->port.flags); | ||
505 | rv = tty_port_block_til_ready(&acm->port, tty, filp); | ||
506 | 576 | ||
507 | mutex_unlock(&acm->mutex); | 577 | mutex_unlock(&acm->mutex); |
508 | out: | ||
509 | mutex_unlock(&open_mutex); | ||
510 | return rv; | ||
511 | 578 | ||
512 | bail_out: | 579 | return 0; |
513 | acm->port.count--; | 580 | |
514 | mutex_unlock(&acm->mutex); | 581 | error_submit_read_urbs: |
582 | acm->ctrlout = 0; | ||
583 | acm_set_control(acm, acm->ctrlout); | ||
584 | error_set_control: | ||
585 | usb_kill_urb(acm->ctrlurb); | ||
586 | error_submit_urb: | ||
515 | usb_autopm_put_interface(acm->control); | 587 | usb_autopm_put_interface(acm->control); |
516 | early_bail: | 588 | error_get_interface: |
517 | mutex_unlock(&open_mutex); | 589 | disconnected: |
518 | tty_port_tty_set(&acm->port, NULL); | 590 | mutex_unlock(&acm->mutex); |
519 | return -EIO; | 591 | return retval; |
520 | } | 592 | } |
521 | 593 | ||
522 | static void acm_tty_unregister(struct acm *acm) | 594 | static void acm_port_destruct(struct tty_port *port) |
523 | { | 595 | { |
524 | int i; | 596 | struct acm *acm = container_of(port, struct acm, port); |
597 | |||
598 | dev_dbg(&acm->control->dev, "%s\n", __func__); | ||
525 | 599 | ||
526 | tty_unregister_device(acm_tty_driver, acm->minor); | 600 | tty_unregister_device(acm_tty_driver, acm->minor); |
601 | acm_release_minor(acm); | ||
527 | usb_put_intf(acm->control); | 602 | usb_put_intf(acm->control); |
528 | acm_table[acm->minor] = NULL; | ||
529 | usb_free_urb(acm->ctrlurb); | ||
530 | for (i = 0; i < ACM_NW; i++) | ||
531 | usb_free_urb(acm->wb[i].urb); | ||
532 | for (i = 0; i < acm->rx_buflimit; i++) | ||
533 | usb_free_urb(acm->read_urbs[i]); | ||
534 | kfree(acm->country_codes); | 603 | kfree(acm->country_codes); |
535 | kfree(acm); | 604 | kfree(acm); |
536 | } | 605 | } |
537 | 606 | ||
538 | static void acm_port_down(struct acm *acm) | 607 | static void acm_port_shutdown(struct tty_port *port) |
539 | { | 608 | { |
609 | struct acm *acm = container_of(port, struct acm, port); | ||
540 | int i; | 610 | int i; |
541 | 611 | ||
542 | if (acm->dev) { | 612 | dev_dbg(&acm->control->dev, "%s\n", __func__); |
613 | |||
614 | mutex_lock(&acm->mutex); | ||
615 | if (!acm->disconnected) { | ||
543 | usb_autopm_get_interface(acm->control); | 616 | usb_autopm_get_interface(acm->control); |
544 | acm_set_control(acm, acm->ctrlout = 0); | 617 | acm_set_control(acm, acm->ctrlout = 0); |
545 | usb_kill_urb(acm->ctrlurb); | 618 | usb_kill_urb(acm->ctrlurb); |
@@ -550,40 +623,28 @@ static void acm_port_down(struct acm *acm) | |||
550 | acm->control->needs_remote_wakeup = 0; | 623 | acm->control->needs_remote_wakeup = 0; |
551 | usb_autopm_put_interface(acm->control); | 624 | usb_autopm_put_interface(acm->control); |
552 | } | 625 | } |
626 | mutex_unlock(&acm->mutex); | ||
627 | } | ||
628 | |||
629 | static void acm_tty_cleanup(struct tty_struct *tty) | ||
630 | { | ||
631 | struct acm *acm = tty->driver_data; | ||
632 | dev_dbg(&acm->control->dev, "%s\n", __func__); | ||
633 | tty_port_put(&acm->port); | ||
553 | } | 634 | } |
554 | 635 | ||
555 | static void acm_tty_hangup(struct tty_struct *tty) | 636 | static void acm_tty_hangup(struct tty_struct *tty) |
556 | { | 637 | { |
557 | struct acm *acm = tty->driver_data; | 638 | struct acm *acm = tty->driver_data; |
639 | dev_dbg(&acm->control->dev, "%s\n", __func__); | ||
558 | tty_port_hangup(&acm->port); | 640 | tty_port_hangup(&acm->port); |
559 | mutex_lock(&open_mutex); | ||
560 | acm_port_down(acm); | ||
561 | mutex_unlock(&open_mutex); | ||
562 | } | 641 | } |
563 | 642 | ||
564 | static void acm_tty_close(struct tty_struct *tty, struct file *filp) | 643 | static void acm_tty_close(struct tty_struct *tty, struct file *filp) |
565 | { | 644 | { |
566 | struct acm *acm = tty->driver_data; | 645 | struct acm *acm = tty->driver_data; |
567 | 646 | dev_dbg(&acm->control->dev, "%s\n", __func__); | |
568 | /* Perform the closing process and see if we need to do the hardware | 647 | tty_port_close(&acm->port, tty, filp); |
569 | shutdown */ | ||
570 | if (!acm) | ||
571 | return; | ||
572 | |||
573 | mutex_lock(&open_mutex); | ||
574 | if (tty_port_close_start(&acm->port, tty, filp) == 0) { | ||
575 | if (!acm->dev) { | ||
576 | tty_port_tty_set(&acm->port, NULL); | ||
577 | acm_tty_unregister(acm); | ||
578 | tty->driver_data = NULL; | ||
579 | } | ||
580 | mutex_unlock(&open_mutex); | ||
581 | return; | ||
582 | } | ||
583 | acm_port_down(acm); | ||
584 | tty_port_close_end(&acm->port, tty); | ||
585 | tty_port_tty_set(&acm->port, NULL); | ||
586 | mutex_unlock(&open_mutex); | ||
587 | } | 648 | } |
588 | 649 | ||
589 | static int acm_tty_write(struct tty_struct *tty, | 650 | static int acm_tty_write(struct tty_struct *tty, |
@@ -595,8 +656,6 @@ static int acm_tty_write(struct tty_struct *tty, | |||
595 | int wbn; | 656 | int wbn; |
596 | struct acm_wb *wb; | 657 | struct acm_wb *wb; |
597 | 658 | ||
598 | if (!ACM_READY(acm)) | ||
599 | return -EINVAL; | ||
600 | if (!count) | 659 | if (!count) |
601 | return 0; | 660 | return 0; |
602 | 661 | ||
@@ -625,8 +684,6 @@ static int acm_tty_write(struct tty_struct *tty, | |||
625 | static int acm_tty_write_room(struct tty_struct *tty) | 684 | static int acm_tty_write_room(struct tty_struct *tty) |
626 | { | 685 | { |
627 | struct acm *acm = tty->driver_data; | 686 | struct acm *acm = tty->driver_data; |
628 | if (!ACM_READY(acm)) | ||
629 | return -EINVAL; | ||
630 | /* | 687 | /* |
631 | * Do not let the line discipline to know that we have a reserve, | 688 | * Do not let the line discipline to know that we have a reserve, |
632 | * or it might get too enthusiastic. | 689 | * or it might get too enthusiastic. |
@@ -637,7 +694,11 @@ static int acm_tty_write_room(struct tty_struct *tty) | |||
637 | static int acm_tty_chars_in_buffer(struct tty_struct *tty) | 694 | static int acm_tty_chars_in_buffer(struct tty_struct *tty) |
638 | { | 695 | { |
639 | struct acm *acm = tty->driver_data; | 696 | struct acm *acm = tty->driver_data; |
640 | if (!ACM_READY(acm)) | 697 | /* |
698 | * if the device was unplugged then any remaining characters fell out | ||
699 | * of the connector ;) | ||
700 | */ | ||
701 | if (acm->disconnected) | ||
641 | return 0; | 702 | return 0; |
642 | /* | 703 | /* |
643 | * This is inaccurate (overcounts), but it works. | 704 | * This is inaccurate (overcounts), but it works. |
@@ -649,9 +710,6 @@ static void acm_tty_throttle(struct tty_struct *tty) | |||
649 | { | 710 | { |
650 | struct acm *acm = tty->driver_data; | 711 | struct acm *acm = tty->driver_data; |
651 | 712 | ||
652 | if (!ACM_READY(acm)) | ||
653 | return; | ||
654 | |||
655 | spin_lock_irq(&acm->read_lock); | 713 | spin_lock_irq(&acm->read_lock); |
656 | acm->throttle_req = 1; | 714 | acm->throttle_req = 1; |
657 | spin_unlock_irq(&acm->read_lock); | 715 | spin_unlock_irq(&acm->read_lock); |
@@ -662,9 +720,6 @@ static void acm_tty_unthrottle(struct tty_struct *tty) | |||
662 | struct acm *acm = tty->driver_data; | 720 | struct acm *acm = tty->driver_data; |
663 | unsigned int was_throttled; | 721 | unsigned int was_throttled; |
664 | 722 | ||
665 | if (!ACM_READY(acm)) | ||
666 | return; | ||
667 | |||
668 | spin_lock_irq(&acm->read_lock); | 723 | spin_lock_irq(&acm->read_lock); |
669 | was_throttled = acm->throttled; | 724 | was_throttled = acm->throttled; |
670 | acm->throttled = 0; | 725 | acm->throttled = 0; |
@@ -679,8 +734,7 @@ static int acm_tty_break_ctl(struct tty_struct *tty, int state) | |||
679 | { | 734 | { |
680 | struct acm *acm = tty->driver_data; | 735 | struct acm *acm = tty->driver_data; |
681 | int retval; | 736 | int retval; |
682 | if (!ACM_READY(acm)) | 737 | |
683 | return -EINVAL; | ||
684 | retval = acm_send_break(acm, state ? 0xffff : 0); | 738 | retval = acm_send_break(acm, state ? 0xffff : 0); |
685 | if (retval < 0) | 739 | if (retval < 0) |
686 | dev_dbg(&acm->control->dev, "%s - send break failed\n", | 740 | dev_dbg(&acm->control->dev, "%s - send break failed\n", |
@@ -692,9 +746,6 @@ static int acm_tty_tiocmget(struct tty_struct *tty) | |||
692 | { | 746 | { |
693 | struct acm *acm = tty->driver_data; | 747 | struct acm *acm = tty->driver_data; |
694 | 748 | ||
695 | if (!ACM_READY(acm)) | ||
696 | return -EINVAL; | ||
697 | |||
698 | return (acm->ctrlout & ACM_CTRL_DTR ? TIOCM_DTR : 0) | | 749 | return (acm->ctrlout & ACM_CTRL_DTR ? TIOCM_DTR : 0) | |
699 | (acm->ctrlout & ACM_CTRL_RTS ? TIOCM_RTS : 0) | | 750 | (acm->ctrlout & ACM_CTRL_RTS ? TIOCM_RTS : 0) | |
700 | (acm->ctrlin & ACM_CTRL_DSR ? TIOCM_DSR : 0) | | 751 | (acm->ctrlin & ACM_CTRL_DSR ? TIOCM_DSR : 0) | |
@@ -709,9 +760,6 @@ static int acm_tty_tiocmset(struct tty_struct *tty, | |||
709 | struct acm *acm = tty->driver_data; | 760 | struct acm *acm = tty->driver_data; |
710 | unsigned int newctrl; | 761 | unsigned int newctrl; |
711 | 762 | ||
712 | if (!ACM_READY(acm)) | ||
713 | return -EINVAL; | ||
714 | |||
715 | newctrl = acm->ctrlout; | 763 | newctrl = acm->ctrlout; |
716 | set = (set & TIOCM_DTR ? ACM_CTRL_DTR : 0) | | 764 | set = (set & TIOCM_DTR ? ACM_CTRL_DTR : 0) | |
717 | (set & TIOCM_RTS ? ACM_CTRL_RTS : 0); | 765 | (set & TIOCM_RTS ? ACM_CTRL_RTS : 0); |
@@ -728,11 +776,6 @@ static int acm_tty_tiocmset(struct tty_struct *tty, | |||
728 | static int acm_tty_ioctl(struct tty_struct *tty, | 776 | static int acm_tty_ioctl(struct tty_struct *tty, |
729 | unsigned int cmd, unsigned long arg) | 777 | unsigned int cmd, unsigned long arg) |
730 | { | 778 | { |
731 | struct acm *acm = tty->driver_data; | ||
732 | |||
733 | if (!ACM_READY(acm)) | ||
734 | return -EINVAL; | ||
735 | |||
736 | return -ENOIOCTLCMD; | 779 | return -ENOIOCTLCMD; |
737 | } | 780 | } |
738 | 781 | ||
@@ -756,9 +799,6 @@ static void acm_tty_set_termios(struct tty_struct *tty, | |||
756 | struct usb_cdc_line_coding newline; | 799 | struct usb_cdc_line_coding newline; |
757 | int newctrl = acm->ctrlout; | 800 | int newctrl = acm->ctrlout; |
758 | 801 | ||
759 | if (!ACM_READY(acm)) | ||
760 | return; | ||
761 | |||
762 | newline.dwDTERate = cpu_to_le32(tty_get_baud_rate(tty)); | 802 | newline.dwDTERate = cpu_to_le32(tty_get_baud_rate(tty)); |
763 | newline.bCharFormat = termios->c_cflag & CSTOPB ? 2 : 0; | 803 | newline.bCharFormat = termios->c_cflag & CSTOPB ? 2 : 0; |
764 | newline.bParityType = termios->c_cflag & PARENB ? | 804 | newline.bParityType = termios->c_cflag & PARENB ? |
@@ -788,6 +828,12 @@ static void acm_tty_set_termios(struct tty_struct *tty, | |||
788 | } | 828 | } |
789 | } | 829 | } |
790 | 830 | ||
831 | static const struct tty_port_operations acm_port_ops = { | ||
832 | .shutdown = acm_port_shutdown, | ||
833 | .activate = acm_port_activate, | ||
834 | .destruct = acm_port_destruct, | ||
835 | }; | ||
836 | |||
791 | /* | 837 | /* |
792 | * USB probe and disconnect routines. | 838 | * USB probe and disconnect routines. |
793 | */ | 839 | */ |
@@ -1047,12 +1093,6 @@ skip_normal_probe: | |||
1047 | } | 1093 | } |
1048 | made_compressed_probe: | 1094 | made_compressed_probe: |
1049 | dev_dbg(&intf->dev, "interfaces are valid\n"); | 1095 | dev_dbg(&intf->dev, "interfaces are valid\n"); |
1050 | for (minor = 0; minor < ACM_TTY_MINORS && acm_table[minor]; minor++); | ||
1051 | |||
1052 | if (minor == ACM_TTY_MINORS) { | ||
1053 | dev_err(&intf->dev, "no more free acm devices\n"); | ||
1054 | return -ENODEV; | ||
1055 | } | ||
1056 | 1096 | ||
1057 | acm = kzalloc(sizeof(struct acm), GFP_KERNEL); | 1097 | acm = kzalloc(sizeof(struct acm), GFP_KERNEL); |
1058 | if (acm == NULL) { | 1098 | if (acm == NULL) { |
@@ -1060,6 +1100,13 @@ made_compressed_probe: | |||
1060 | goto alloc_fail; | 1100 | goto alloc_fail; |
1061 | } | 1101 | } |
1062 | 1102 | ||
1103 | minor = acm_alloc_minor(acm); | ||
1104 | if (minor == ACM_TTY_MINORS) { | ||
1105 | dev_err(&intf->dev, "no more free acm devices\n"); | ||
1106 | kfree(acm); | ||
1107 | return -ENODEV; | ||
1108 | } | ||
1109 | |||
1063 | ctrlsize = usb_endpoint_maxp(epctrl); | 1110 | ctrlsize = usb_endpoint_maxp(epctrl); |
1064 | readsize = usb_endpoint_maxp(epread) * | 1111 | readsize = usb_endpoint_maxp(epread) * |
1065 | (quirks == SINGLE_RX_URB ? 1 : 2); | 1112 | (quirks == SINGLE_RX_URB ? 1 : 2); |
@@ -1218,8 +1265,6 @@ skip_countries: | |||
1218 | usb_get_intf(control_interface); | 1265 | usb_get_intf(control_interface); |
1219 | tty_register_device(acm_tty_driver, minor, &control_interface->dev); | 1266 | tty_register_device(acm_tty_driver, minor, &control_interface->dev); |
1220 | 1267 | ||
1221 | acm_table[minor] = acm; | ||
1222 | |||
1223 | return 0; | 1268 | return 0; |
1224 | alloc_fail7: | 1269 | alloc_fail7: |
1225 | for (i = 0; i < ACM_NW; i++) | 1270 | for (i = 0; i < ACM_NW; i++) |
@@ -1234,6 +1279,7 @@ alloc_fail5: | |||
1234 | alloc_fail4: | 1279 | alloc_fail4: |
1235 | usb_free_coherent(usb_dev, ctrlsize, acm->ctrl_buffer, acm->ctrl_dma); | 1280 | usb_free_coherent(usb_dev, ctrlsize, acm->ctrl_buffer, acm->ctrl_dma); |
1236 | alloc_fail2: | 1281 | alloc_fail2: |
1282 | acm_release_minor(acm); | ||
1237 | kfree(acm); | 1283 | kfree(acm); |
1238 | alloc_fail: | 1284 | alloc_fail: |
1239 | return -ENOMEM; | 1285 | return -ENOMEM; |
@@ -1259,12 +1305,16 @@ static void acm_disconnect(struct usb_interface *intf) | |||
1259 | struct acm *acm = usb_get_intfdata(intf); | 1305 | struct acm *acm = usb_get_intfdata(intf); |
1260 | struct usb_device *usb_dev = interface_to_usbdev(intf); | 1306 | struct usb_device *usb_dev = interface_to_usbdev(intf); |
1261 | struct tty_struct *tty; | 1307 | struct tty_struct *tty; |
1308 | int i; | ||
1309 | |||
1310 | dev_dbg(&intf->dev, "%s\n", __func__); | ||
1262 | 1311 | ||
1263 | /* sibling interface is already cleaning up */ | 1312 | /* sibling interface is already cleaning up */ |
1264 | if (!acm) | 1313 | if (!acm) |
1265 | return; | 1314 | return; |
1266 | 1315 | ||
1267 | mutex_lock(&open_mutex); | 1316 | mutex_lock(&acm->mutex); |
1317 | acm->disconnected = true; | ||
1268 | if (acm->country_codes) { | 1318 | if (acm->country_codes) { |
1269 | device_remove_file(&acm->control->dev, | 1319 | device_remove_file(&acm->control->dev, |
1270 | &dev_attr_wCountryCodes); | 1320 | &dev_attr_wCountryCodes); |
@@ -1272,33 +1322,32 @@ static void acm_disconnect(struct usb_interface *intf) | |||
1272 | &dev_attr_iCountryCodeRelDate); | 1322 | &dev_attr_iCountryCodeRelDate); |
1273 | } | 1323 | } |
1274 | device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); | 1324 | device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); |
1275 | acm->dev = NULL; | ||
1276 | usb_set_intfdata(acm->control, NULL); | 1325 | usb_set_intfdata(acm->control, NULL); |
1277 | usb_set_intfdata(acm->data, NULL); | 1326 | usb_set_intfdata(acm->data, NULL); |
1327 | mutex_unlock(&acm->mutex); | ||
1328 | |||
1329 | tty = tty_port_tty_get(&acm->port); | ||
1330 | if (tty) { | ||
1331 | tty_vhangup(tty); | ||
1332 | tty_kref_put(tty); | ||
1333 | } | ||
1278 | 1334 | ||
1279 | stop_data_traffic(acm); | 1335 | stop_data_traffic(acm); |
1280 | 1336 | ||
1337 | usb_free_urb(acm->ctrlurb); | ||
1338 | for (i = 0; i < ACM_NW; i++) | ||
1339 | usb_free_urb(acm->wb[i].urb); | ||
1340 | for (i = 0; i < acm->rx_buflimit; i++) | ||
1341 | usb_free_urb(acm->read_urbs[i]); | ||
1281 | acm_write_buffers_free(acm); | 1342 | acm_write_buffers_free(acm); |
1282 | usb_free_coherent(usb_dev, acm->ctrlsize, acm->ctrl_buffer, | 1343 | usb_free_coherent(usb_dev, acm->ctrlsize, acm->ctrl_buffer, acm->ctrl_dma); |
1283 | acm->ctrl_dma); | ||
1284 | acm_read_buffers_free(acm); | 1344 | acm_read_buffers_free(acm); |
1285 | 1345 | ||
1286 | if (!acm->combined_interfaces) | 1346 | if (!acm->combined_interfaces) |
1287 | usb_driver_release_interface(&acm_driver, intf == acm->control ? | 1347 | usb_driver_release_interface(&acm_driver, intf == acm->control ? |
1288 | acm->data : acm->control); | 1348 | acm->data : acm->control); |
1289 | 1349 | ||
1290 | if (acm->port.count == 0) { | 1350 | tty_port_put(&acm->port); |
1291 | acm_tty_unregister(acm); | ||
1292 | mutex_unlock(&open_mutex); | ||
1293 | return; | ||
1294 | } | ||
1295 | |||
1296 | mutex_unlock(&open_mutex); | ||
1297 | tty = tty_port_tty_get(&acm->port); | ||
1298 | if (tty) { | ||
1299 | tty_hangup(tty); | ||
1300 | tty_kref_put(tty); | ||
1301 | } | ||
1302 | } | 1351 | } |
1303 | 1352 | ||
1304 | #ifdef CONFIG_PM | 1353 | #ifdef CONFIG_PM |
@@ -1325,16 +1374,10 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message) | |||
1325 | 1374 | ||
1326 | if (cnt) | 1375 | if (cnt) |
1327 | return 0; | 1376 | return 0; |
1328 | /* | ||
1329 | we treat opened interfaces differently, | ||
1330 | we must guard against open | ||
1331 | */ | ||
1332 | mutex_lock(&acm->mutex); | ||
1333 | 1377 | ||
1334 | if (acm->port.count) | 1378 | if (test_bit(ASYNCB_INITIALIZED, &acm->port.flags)) |
1335 | stop_data_traffic(acm); | 1379 | stop_data_traffic(acm); |
1336 | 1380 | ||
1337 | mutex_unlock(&acm->mutex); | ||
1338 | return 0; | 1381 | return 0; |
1339 | } | 1382 | } |
1340 | 1383 | ||
@@ -1353,8 +1396,7 @@ static int acm_resume(struct usb_interface *intf) | |||
1353 | if (cnt) | 1396 | if (cnt) |
1354 | return 0; | 1397 | return 0; |
1355 | 1398 | ||
1356 | mutex_lock(&acm->mutex); | 1399 | if (test_bit(ASYNCB_INITIALIZED, &acm->port.flags)) { |
1357 | if (acm->port.count) { | ||
1358 | rv = usb_submit_urb(acm->ctrlurb, GFP_NOIO); | 1400 | rv = usb_submit_urb(acm->ctrlurb, GFP_NOIO); |
1359 | 1401 | ||
1360 | spin_lock_irq(&acm->write_lock); | 1402 | spin_lock_irq(&acm->write_lock); |
@@ -1378,7 +1420,6 @@ static int acm_resume(struct usb_interface *intf) | |||
1378 | } | 1420 | } |
1379 | 1421 | ||
1380 | err_out: | 1422 | err_out: |
1381 | mutex_unlock(&acm->mutex); | ||
1382 | return rv; | 1423 | return rv; |
1383 | } | 1424 | } |
1384 | 1425 | ||
@@ -1387,15 +1428,14 @@ static int acm_reset_resume(struct usb_interface *intf) | |||
1387 | struct acm *acm = usb_get_intfdata(intf); | 1428 | struct acm *acm = usb_get_intfdata(intf); |
1388 | struct tty_struct *tty; | 1429 | struct tty_struct *tty; |
1389 | 1430 | ||
1390 | mutex_lock(&acm->mutex); | 1431 | if (test_bit(ASYNCB_INITIALIZED, &acm->port.flags)) { |
1391 | if (acm->port.count) { | ||
1392 | tty = tty_port_tty_get(&acm->port); | 1432 | tty = tty_port_tty_get(&acm->port); |
1393 | if (tty) { | 1433 | if (tty) { |
1394 | tty_hangup(tty); | 1434 | tty_hangup(tty); |
1395 | tty_kref_put(tty); | 1435 | tty_kref_put(tty); |
1396 | } | 1436 | } |
1397 | } | 1437 | } |
1398 | mutex_unlock(&acm->mutex); | 1438 | |
1399 | return acm_resume(intf); | 1439 | return acm_resume(intf); |
1400 | } | 1440 | } |
1401 | 1441 | ||
@@ -1594,8 +1634,10 @@ static struct usb_driver acm_driver = { | |||
1594 | */ | 1634 | */ |
1595 | 1635 | ||
1596 | static const struct tty_operations acm_ops = { | 1636 | static const struct tty_operations acm_ops = { |
1637 | .install = acm_tty_install, | ||
1597 | .open = acm_tty_open, | 1638 | .open = acm_tty_open, |
1598 | .close = acm_tty_close, | 1639 | .close = acm_tty_close, |
1640 | .cleanup = acm_tty_cleanup, | ||
1599 | .hangup = acm_tty_hangup, | 1641 | .hangup = acm_tty_hangup, |
1600 | .write = acm_tty_write, | 1642 | .write = acm_tty_write, |
1601 | .write_room = acm_tty_write_room, | 1643 | .write_room = acm_tty_write_room, |
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h index ca7937f26e27..35ef887b7417 100644 --- a/drivers/usb/class/cdc-acm.h +++ b/drivers/usb/class/cdc-acm.h | |||
@@ -101,6 +101,7 @@ struct acm { | |||
101 | int transmitting; | 101 | int transmitting; |
102 | spinlock_t write_lock; | 102 | spinlock_t write_lock; |
103 | struct mutex mutex; | 103 | struct mutex mutex; |
104 | bool disconnected; | ||
104 | struct usb_cdc_line_coding line; /* bits, stop, parity */ | 105 | struct usb_cdc_line_coding line; /* bits, stop, parity */ |
105 | struct work_struct work; /* work queue entry for line discipline waking up */ | 106 | struct work_struct work; /* work queue entry for line discipline waking up */ |
106 | unsigned int ctrlin; /* input control lines (DCD, DSR, RI, break, overruns) */ | 107 | unsigned int ctrlin; /* input control lines (DCD, DSR, RI, break, overruns) */ |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index e3beaf229ee3..d8cf06f186f2 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -86,6 +86,7 @@ struct async { | |||
86 | void __user *userbuffer; | 86 | void __user *userbuffer; |
87 | void __user *userurb; | 87 | void __user *userurb; |
88 | struct urb *urb; | 88 | struct urb *urb; |
89 | unsigned int mem_usage; | ||
89 | int status; | 90 | int status; |
90 | u32 secid; | 91 | u32 secid; |
91 | u8 bulk_addr; | 92 | u8 bulk_addr; |
@@ -108,8 +109,44 @@ enum snoop_when { | |||
108 | 109 | ||
109 | #define USB_DEVICE_DEV MKDEV(USB_DEVICE_MAJOR, 0) | 110 | #define USB_DEVICE_DEV MKDEV(USB_DEVICE_MAJOR, 0) |
110 | 111 | ||
111 | #define MAX_USBFS_BUFFER_SIZE 16384 | 112 | /* Limit on the total amount of memory we can allocate for transfers */ |
113 | static unsigned usbfs_memory_mb = 16; | ||
114 | module_param(usbfs_memory_mb, uint, 0644); | ||
115 | MODULE_PARM_DESC(usbfs_memory_mb, | ||
116 | "maximum MB allowed for usbfs buffers (0 = no limit)"); | ||
112 | 117 | ||
118 | /* Hard limit, necessary to avoid aithmetic overflow */ | ||
119 | #define USBFS_XFER_MAX (UINT_MAX / 2 - 1000000) | ||
120 | |||
121 | static atomic_t usbfs_memory_usage; /* Total memory currently allocated */ | ||
122 | |||
123 | /* Check whether it's okay to allocate more memory for a transfer */ | ||
124 | static int usbfs_increase_memory_usage(unsigned amount) | ||
125 | { | ||
126 | unsigned lim; | ||
127 | |||
128 | /* | ||
129 | * Convert usbfs_memory_mb to bytes, avoiding overflows. | ||
130 | * 0 means use the hard limit (effectively unlimited). | ||
131 | */ | ||
132 | lim = ACCESS_ONCE(usbfs_memory_mb); | ||
133 | if (lim == 0 || lim > (USBFS_XFER_MAX >> 20)) | ||
134 | lim = USBFS_XFER_MAX; | ||
135 | else | ||
136 | lim <<= 20; | ||
137 | |||
138 | atomic_add(amount, &usbfs_memory_usage); | ||
139 | if (atomic_read(&usbfs_memory_usage) <= lim) | ||
140 | return 0; | ||
141 | atomic_sub(amount, &usbfs_memory_usage); | ||
142 | return -ENOMEM; | ||
143 | } | ||
144 | |||
145 | /* Memory for a transfer is being deallocated */ | ||
146 | static void usbfs_decrease_memory_usage(unsigned amount) | ||
147 | { | ||
148 | atomic_sub(amount, &usbfs_memory_usage); | ||
149 | } | ||
113 | 150 | ||
114 | static int connected(struct dev_state *ps) | 151 | static int connected(struct dev_state *ps) |
115 | { | 152 | { |
@@ -253,6 +290,7 @@ static void free_async(struct async *as) | |||
253 | kfree(as->urb->transfer_buffer); | 290 | kfree(as->urb->transfer_buffer); |
254 | kfree(as->urb->setup_packet); | 291 | kfree(as->urb->setup_packet); |
255 | usb_free_urb(as->urb); | 292 | usb_free_urb(as->urb); |
293 | usbfs_decrease_memory_usage(as->mem_usage); | ||
256 | kfree(as); | 294 | kfree(as); |
257 | } | 295 | } |
258 | 296 | ||
@@ -792,9 +830,15 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
792 | wLength = ctrl.wLength; /* To suppress 64k PAGE_SIZE warning */ | 830 | wLength = ctrl.wLength; /* To suppress 64k PAGE_SIZE warning */ |
793 | if (wLength > PAGE_SIZE) | 831 | if (wLength > PAGE_SIZE) |
794 | return -EINVAL; | 832 | return -EINVAL; |
833 | ret = usbfs_increase_memory_usage(PAGE_SIZE + sizeof(struct urb) + | ||
834 | sizeof(struct usb_ctrlrequest)); | ||
835 | if (ret) | ||
836 | return ret; | ||
795 | tbuf = (unsigned char *)__get_free_page(GFP_KERNEL); | 837 | tbuf = (unsigned char *)__get_free_page(GFP_KERNEL); |
796 | if (!tbuf) | 838 | if (!tbuf) { |
797 | return -ENOMEM; | 839 | ret = -ENOMEM; |
840 | goto done; | ||
841 | } | ||
798 | tmo = ctrl.timeout; | 842 | tmo = ctrl.timeout; |
799 | snoop(&dev->dev, "control urb: bRequestType=%02x " | 843 | snoop(&dev->dev, "control urb: bRequestType=%02x " |
800 | "bRequest=%02x wValue=%04x " | 844 | "bRequest=%02x wValue=%04x " |
@@ -806,8 +850,8 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
806 | if (ctrl.bRequestType & 0x80) { | 850 | if (ctrl.bRequestType & 0x80) { |
807 | if (ctrl.wLength && !access_ok(VERIFY_WRITE, ctrl.data, | 851 | if (ctrl.wLength && !access_ok(VERIFY_WRITE, ctrl.data, |
808 | ctrl.wLength)) { | 852 | ctrl.wLength)) { |
809 | free_page((unsigned long)tbuf); | 853 | ret = -EINVAL; |
810 | return -EINVAL; | 854 | goto done; |
811 | } | 855 | } |
812 | pipe = usb_rcvctrlpipe(dev, 0); | 856 | pipe = usb_rcvctrlpipe(dev, 0); |
813 | snoop_urb(dev, NULL, pipe, ctrl.wLength, tmo, SUBMIT, NULL, 0); | 857 | snoop_urb(dev, NULL, pipe, ctrl.wLength, tmo, SUBMIT, NULL, 0); |
@@ -821,15 +865,15 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
821 | tbuf, max(i, 0)); | 865 | tbuf, max(i, 0)); |
822 | if ((i > 0) && ctrl.wLength) { | 866 | if ((i > 0) && ctrl.wLength) { |
823 | if (copy_to_user(ctrl.data, tbuf, i)) { | 867 | if (copy_to_user(ctrl.data, tbuf, i)) { |
824 | free_page((unsigned long)tbuf); | 868 | ret = -EFAULT; |
825 | return -EFAULT; | 869 | goto done; |
826 | } | 870 | } |
827 | } | 871 | } |
828 | } else { | 872 | } else { |
829 | if (ctrl.wLength) { | 873 | if (ctrl.wLength) { |
830 | if (copy_from_user(tbuf, ctrl.data, ctrl.wLength)) { | 874 | if (copy_from_user(tbuf, ctrl.data, ctrl.wLength)) { |
831 | free_page((unsigned long)tbuf); | 875 | ret = -EFAULT; |
832 | return -EFAULT; | 876 | goto done; |
833 | } | 877 | } |
834 | } | 878 | } |
835 | pipe = usb_sndctrlpipe(dev, 0); | 879 | pipe = usb_sndctrlpipe(dev, 0); |
@@ -843,14 +887,18 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
843 | usb_lock_device(dev); | 887 | usb_lock_device(dev); |
844 | snoop_urb(dev, NULL, pipe, max(i, 0), min(i, 0), COMPLETE, NULL, 0); | 888 | snoop_urb(dev, NULL, pipe, max(i, 0), min(i, 0), COMPLETE, NULL, 0); |
845 | } | 889 | } |
846 | free_page((unsigned long)tbuf); | ||
847 | if (i < 0 && i != -EPIPE) { | 890 | if (i < 0 && i != -EPIPE) { |
848 | dev_printk(KERN_DEBUG, &dev->dev, "usbfs: USBDEVFS_CONTROL " | 891 | dev_printk(KERN_DEBUG, &dev->dev, "usbfs: USBDEVFS_CONTROL " |
849 | "failed cmd %s rqt %u rq %u len %u ret %d\n", | 892 | "failed cmd %s rqt %u rq %u len %u ret %d\n", |
850 | current->comm, ctrl.bRequestType, ctrl.bRequest, | 893 | current->comm, ctrl.bRequestType, ctrl.bRequest, |
851 | ctrl.wLength, i); | 894 | ctrl.wLength, i); |
852 | } | 895 | } |
853 | return i; | 896 | ret = i; |
897 | done: | ||
898 | free_page((unsigned long) tbuf); | ||
899 | usbfs_decrease_memory_usage(PAGE_SIZE + sizeof(struct urb) + | ||
900 | sizeof(struct usb_ctrlrequest)); | ||
901 | return ret; | ||
854 | } | 902 | } |
855 | 903 | ||
856 | static int proc_bulk(struct dev_state *ps, void __user *arg) | 904 | static int proc_bulk(struct dev_state *ps, void __user *arg) |
@@ -877,15 +925,20 @@ static int proc_bulk(struct dev_state *ps, void __user *arg) | |||
877 | if (!usb_maxpacket(dev, pipe, !(bulk.ep & USB_DIR_IN))) | 925 | if (!usb_maxpacket(dev, pipe, !(bulk.ep & USB_DIR_IN))) |
878 | return -EINVAL; | 926 | return -EINVAL; |
879 | len1 = bulk.len; | 927 | len1 = bulk.len; |
880 | if (len1 > MAX_USBFS_BUFFER_SIZE) | 928 | if (len1 >= USBFS_XFER_MAX) |
881 | return -EINVAL; | 929 | return -EINVAL; |
882 | if (!(tbuf = kmalloc(len1, GFP_KERNEL))) | 930 | ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb)); |
883 | return -ENOMEM; | 931 | if (ret) |
932 | return ret; | ||
933 | if (!(tbuf = kmalloc(len1, GFP_KERNEL))) { | ||
934 | ret = -ENOMEM; | ||
935 | goto done; | ||
936 | } | ||
884 | tmo = bulk.timeout; | 937 | tmo = bulk.timeout; |
885 | if (bulk.ep & 0x80) { | 938 | if (bulk.ep & 0x80) { |
886 | if (len1 && !access_ok(VERIFY_WRITE, bulk.data, len1)) { | 939 | if (len1 && !access_ok(VERIFY_WRITE, bulk.data, len1)) { |
887 | kfree(tbuf); | 940 | ret = -EINVAL; |
888 | return -EINVAL; | 941 | goto done; |
889 | } | 942 | } |
890 | snoop_urb(dev, NULL, pipe, len1, tmo, SUBMIT, NULL, 0); | 943 | snoop_urb(dev, NULL, pipe, len1, tmo, SUBMIT, NULL, 0); |
891 | 944 | ||
@@ -896,15 +949,15 @@ static int proc_bulk(struct dev_state *ps, void __user *arg) | |||
896 | 949 | ||
897 | if (!i && len2) { | 950 | if (!i && len2) { |
898 | if (copy_to_user(bulk.data, tbuf, len2)) { | 951 | if (copy_to_user(bulk.data, tbuf, len2)) { |
899 | kfree(tbuf); | 952 | ret = -EFAULT; |
900 | return -EFAULT; | 953 | goto done; |
901 | } | 954 | } |
902 | } | 955 | } |
903 | } else { | 956 | } else { |
904 | if (len1) { | 957 | if (len1) { |
905 | if (copy_from_user(tbuf, bulk.data, len1)) { | 958 | if (copy_from_user(tbuf, bulk.data, len1)) { |
906 | kfree(tbuf); | 959 | ret = -EFAULT; |
907 | return -EFAULT; | 960 | goto done; |
908 | } | 961 | } |
909 | } | 962 | } |
910 | snoop_urb(dev, NULL, pipe, len1, tmo, SUBMIT, tbuf, len1); | 963 | snoop_urb(dev, NULL, pipe, len1, tmo, SUBMIT, tbuf, len1); |
@@ -914,10 +967,11 @@ static int proc_bulk(struct dev_state *ps, void __user *arg) | |||
914 | usb_lock_device(dev); | 967 | usb_lock_device(dev); |
915 | snoop_urb(dev, NULL, pipe, len2, i, COMPLETE, NULL, 0); | 968 | snoop_urb(dev, NULL, pipe, len2, i, COMPLETE, NULL, 0); |
916 | } | 969 | } |
970 | ret = (i < 0 ? i : len2); | ||
971 | done: | ||
917 | kfree(tbuf); | 972 | kfree(tbuf); |
918 | if (i < 0) | 973 | usbfs_decrease_memory_usage(len1 + sizeof(struct urb)); |
919 | return i; | 974 | return ret; |
920 | return len2; | ||
921 | } | 975 | } |
922 | 976 | ||
923 | static int proc_resetep(struct dev_state *ps, void __user *arg) | 977 | static int proc_resetep(struct dev_state *ps, void __user *arg) |
@@ -1062,7 +1116,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1062 | { | 1116 | { |
1063 | struct usbdevfs_iso_packet_desc *isopkt = NULL; | 1117 | struct usbdevfs_iso_packet_desc *isopkt = NULL; |
1064 | struct usb_host_endpoint *ep; | 1118 | struct usb_host_endpoint *ep; |
1065 | struct async *as; | 1119 | struct async *as = NULL; |
1066 | struct usb_ctrlrequest *dr = NULL; | 1120 | struct usb_ctrlrequest *dr = NULL; |
1067 | unsigned int u, totlen, isofrmlen; | 1121 | unsigned int u, totlen, isofrmlen; |
1068 | int ret, ifnum = -1; | 1122 | int ret, ifnum = -1; |
@@ -1095,32 +1149,30 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1095 | } | 1149 | } |
1096 | if (!ep) | 1150 | if (!ep) |
1097 | return -ENOENT; | 1151 | return -ENOENT; |
1152 | |||
1153 | u = 0; | ||
1098 | switch(uurb->type) { | 1154 | switch(uurb->type) { |
1099 | case USBDEVFS_URB_TYPE_CONTROL: | 1155 | case USBDEVFS_URB_TYPE_CONTROL: |
1100 | if (!usb_endpoint_xfer_control(&ep->desc)) | 1156 | if (!usb_endpoint_xfer_control(&ep->desc)) |
1101 | return -EINVAL; | 1157 | return -EINVAL; |
1102 | /* min 8 byte setup packet, | 1158 | /* min 8 byte setup packet */ |
1103 | * max 8 byte setup plus an arbitrary data stage */ | 1159 | if (uurb->buffer_length < 8) |
1104 | if (uurb->buffer_length < 8 || | ||
1105 | uurb->buffer_length > (8 + MAX_USBFS_BUFFER_SIZE)) | ||
1106 | return -EINVAL; | 1160 | return -EINVAL; |
1107 | dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); | 1161 | dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); |
1108 | if (!dr) | 1162 | if (!dr) |
1109 | return -ENOMEM; | 1163 | return -ENOMEM; |
1110 | if (copy_from_user(dr, uurb->buffer, 8)) { | 1164 | if (copy_from_user(dr, uurb->buffer, 8)) { |
1111 | kfree(dr); | 1165 | ret = -EFAULT; |
1112 | return -EFAULT; | 1166 | goto error; |
1113 | } | 1167 | } |
1114 | if (uurb->buffer_length < (le16_to_cpup(&dr->wLength) + 8)) { | 1168 | if (uurb->buffer_length < (le16_to_cpup(&dr->wLength) + 8)) { |
1115 | kfree(dr); | 1169 | ret = -EINVAL; |
1116 | return -EINVAL; | 1170 | goto error; |
1117 | } | 1171 | } |
1118 | ret = check_ctrlrecip(ps, dr->bRequestType, dr->bRequest, | 1172 | ret = check_ctrlrecip(ps, dr->bRequestType, dr->bRequest, |
1119 | le16_to_cpup(&dr->wIndex)); | 1173 | le16_to_cpup(&dr->wIndex)); |
1120 | if (ret) { | 1174 | if (ret) |
1121 | kfree(dr); | 1175 | goto error; |
1122 | return ret; | ||
1123 | } | ||
1124 | uurb->number_of_packets = 0; | 1176 | uurb->number_of_packets = 0; |
1125 | uurb->buffer_length = le16_to_cpup(&dr->wLength); | 1177 | uurb->buffer_length = le16_to_cpup(&dr->wLength); |
1126 | uurb->buffer += 8; | 1178 | uurb->buffer += 8; |
@@ -1138,6 +1190,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1138 | __le16_to_cpup(&dr->wValue), | 1190 | __le16_to_cpup(&dr->wValue), |
1139 | __le16_to_cpup(&dr->wIndex), | 1191 | __le16_to_cpup(&dr->wIndex), |
1140 | __le16_to_cpup(&dr->wLength)); | 1192 | __le16_to_cpup(&dr->wLength)); |
1193 | u = sizeof(struct usb_ctrlrequest); | ||
1141 | break; | 1194 | break; |
1142 | 1195 | ||
1143 | case USBDEVFS_URB_TYPE_BULK: | 1196 | case USBDEVFS_URB_TYPE_BULK: |
@@ -1151,8 +1204,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1151 | goto interrupt_urb; | 1204 | goto interrupt_urb; |
1152 | } | 1205 | } |
1153 | uurb->number_of_packets = 0; | 1206 | uurb->number_of_packets = 0; |
1154 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) | ||
1155 | return -EINVAL; | ||
1156 | break; | 1207 | break; |
1157 | 1208 | ||
1158 | case USBDEVFS_URB_TYPE_INTERRUPT: | 1209 | case USBDEVFS_URB_TYPE_INTERRUPT: |
@@ -1160,8 +1211,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1160 | return -EINVAL; | 1211 | return -EINVAL; |
1161 | interrupt_urb: | 1212 | interrupt_urb: |
1162 | uurb->number_of_packets = 0; | 1213 | uurb->number_of_packets = 0; |
1163 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) | ||
1164 | return -EINVAL; | ||
1165 | break; | 1214 | break; |
1166 | 1215 | ||
1167 | case USBDEVFS_URB_TYPE_ISO: | 1216 | case USBDEVFS_URB_TYPE_ISO: |
@@ -1176,50 +1225,53 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1176 | if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL))) | 1225 | if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL))) |
1177 | return -ENOMEM; | 1226 | return -ENOMEM; |
1178 | if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) { | 1227 | if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) { |
1179 | kfree(isopkt); | 1228 | ret = -EFAULT; |
1180 | return -EFAULT; | 1229 | goto error; |
1181 | } | 1230 | } |
1182 | for (totlen = u = 0; u < uurb->number_of_packets; u++) { | 1231 | for (totlen = u = 0; u < uurb->number_of_packets; u++) { |
1183 | /* arbitrary limit, | 1232 | /* arbitrary limit, |
1184 | * sufficient for USB 2.0 high-bandwidth iso */ | 1233 | * sufficient for USB 2.0 high-bandwidth iso */ |
1185 | if (isopkt[u].length > 8192) { | 1234 | if (isopkt[u].length > 8192) { |
1186 | kfree(isopkt); | 1235 | ret = -EINVAL; |
1187 | return -EINVAL; | 1236 | goto error; |
1188 | } | 1237 | } |
1189 | totlen += isopkt[u].length; | 1238 | totlen += isopkt[u].length; |
1190 | } | 1239 | } |
1191 | /* 3072 * 64 microframes */ | 1240 | u *= sizeof(struct usb_iso_packet_descriptor); |
1192 | if (totlen > 196608) { | ||
1193 | kfree(isopkt); | ||
1194 | return -EINVAL; | ||
1195 | } | ||
1196 | uurb->buffer_length = totlen; | 1241 | uurb->buffer_length = totlen; |
1197 | break; | 1242 | break; |
1198 | 1243 | ||
1199 | default: | 1244 | default: |
1200 | return -EINVAL; | 1245 | return -EINVAL; |
1201 | } | 1246 | } |
1247 | |||
1248 | if (uurb->buffer_length >= USBFS_XFER_MAX) { | ||
1249 | ret = -EINVAL; | ||
1250 | goto error; | ||
1251 | } | ||
1202 | if (uurb->buffer_length > 0 && | 1252 | if (uurb->buffer_length > 0 && |
1203 | !access_ok(is_in ? VERIFY_WRITE : VERIFY_READ, | 1253 | !access_ok(is_in ? VERIFY_WRITE : VERIFY_READ, |
1204 | uurb->buffer, uurb->buffer_length)) { | 1254 | uurb->buffer, uurb->buffer_length)) { |
1205 | kfree(isopkt); | 1255 | ret = -EFAULT; |
1206 | kfree(dr); | 1256 | goto error; |
1207 | return -EFAULT; | ||
1208 | } | 1257 | } |
1209 | as = alloc_async(uurb->number_of_packets); | 1258 | as = alloc_async(uurb->number_of_packets); |
1210 | if (!as) { | 1259 | if (!as) { |
1211 | kfree(isopkt); | 1260 | ret = -ENOMEM; |
1212 | kfree(dr); | 1261 | goto error; |
1213 | return -ENOMEM; | ||
1214 | } | 1262 | } |
1263 | u += sizeof(struct async) + sizeof(struct urb) + uurb->buffer_length; | ||
1264 | ret = usbfs_increase_memory_usage(u); | ||
1265 | if (ret) | ||
1266 | goto error; | ||
1267 | as->mem_usage = u; | ||
1268 | |||
1215 | if (uurb->buffer_length > 0) { | 1269 | if (uurb->buffer_length > 0) { |
1216 | as->urb->transfer_buffer = kmalloc(uurb->buffer_length, | 1270 | as->urb->transfer_buffer = kmalloc(uurb->buffer_length, |
1217 | GFP_KERNEL); | 1271 | GFP_KERNEL); |
1218 | if (!as->urb->transfer_buffer) { | 1272 | if (!as->urb->transfer_buffer) { |
1219 | kfree(isopkt); | 1273 | ret = -ENOMEM; |
1220 | kfree(dr); | 1274 | goto error; |
1221 | free_async(as); | ||
1222 | return -ENOMEM; | ||
1223 | } | 1275 | } |
1224 | /* Isochronous input data may end up being discontiguous | 1276 | /* Isochronous input data may end up being discontiguous |
1225 | * if some of the packets are short. Clear the buffer so | 1277 | * if some of the packets are short. Clear the buffer so |
@@ -1253,6 +1305,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1253 | 1305 | ||
1254 | as->urb->transfer_buffer_length = uurb->buffer_length; | 1306 | as->urb->transfer_buffer_length = uurb->buffer_length; |
1255 | as->urb->setup_packet = (unsigned char *)dr; | 1307 | as->urb->setup_packet = (unsigned char *)dr; |
1308 | dr = NULL; | ||
1256 | as->urb->start_frame = uurb->start_frame; | 1309 | as->urb->start_frame = uurb->start_frame; |
1257 | as->urb->number_of_packets = uurb->number_of_packets; | 1310 | as->urb->number_of_packets = uurb->number_of_packets; |
1258 | if (uurb->type == USBDEVFS_URB_TYPE_ISO || | 1311 | if (uurb->type == USBDEVFS_URB_TYPE_ISO || |
@@ -1268,6 +1321,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1268 | totlen += isopkt[u].length; | 1321 | totlen += isopkt[u].length; |
1269 | } | 1322 | } |
1270 | kfree(isopkt); | 1323 | kfree(isopkt); |
1324 | isopkt = NULL; | ||
1271 | as->ps = ps; | 1325 | as->ps = ps; |
1272 | as->userurb = arg; | 1326 | as->userurb = arg; |
1273 | if (is_in && uurb->buffer_length > 0) | 1327 | if (is_in && uurb->buffer_length > 0) |
@@ -1282,8 +1336,8 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1282 | if (!is_in && uurb->buffer_length > 0) { | 1336 | if (!is_in && uurb->buffer_length > 0) { |
1283 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, | 1337 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, |
1284 | uurb->buffer_length)) { | 1338 | uurb->buffer_length)) { |
1285 | free_async(as); | 1339 | ret = -EFAULT; |
1286 | return -EFAULT; | 1340 | goto error; |
1287 | } | 1341 | } |
1288 | } | 1342 | } |
1289 | snoop_urb(ps->dev, as->userurb, as->urb->pipe, | 1343 | snoop_urb(ps->dev, as->userurb, as->urb->pipe, |
@@ -1329,10 +1383,16 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1329 | snoop_urb(ps->dev, as->userurb, as->urb->pipe, | 1383 | snoop_urb(ps->dev, as->userurb, as->urb->pipe, |
1330 | 0, ret, COMPLETE, NULL, 0); | 1384 | 0, ret, COMPLETE, NULL, 0); |
1331 | async_removepending(as); | 1385 | async_removepending(as); |
1332 | free_async(as); | 1386 | goto error; |
1333 | return ret; | ||
1334 | } | 1387 | } |
1335 | return 0; | 1388 | return 0; |
1389 | |||
1390 | error: | ||
1391 | kfree(isopkt); | ||
1392 | kfree(dr); | ||
1393 | if (as) | ||
1394 | free_async(as); | ||
1395 | return ret; | ||
1336 | } | 1396 | } |
1337 | 1397 | ||
1338 | static int proc_submiturb(struct dev_state *ps, void __user *arg) | 1398 | static int proc_submiturb(struct dev_state *ps, void __user *arg) |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 45887a0ff873..73abd8a0647d 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -45,10 +45,12 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids, | |||
45 | struct usb_dynid *dynid; | 45 | struct usb_dynid *dynid; |
46 | u32 idVendor = 0; | 46 | u32 idVendor = 0; |
47 | u32 idProduct = 0; | 47 | u32 idProduct = 0; |
48 | unsigned int bInterfaceClass = 0; | ||
48 | int fields = 0; | 49 | int fields = 0; |
49 | int retval = 0; | 50 | int retval = 0; |
50 | 51 | ||
51 | fields = sscanf(buf, "%x %x", &idVendor, &idProduct); | 52 | fields = sscanf(buf, "%x %x %x", &idVendor, &idProduct, |
53 | &bInterfaceClass); | ||
52 | if (fields < 2) | 54 | if (fields < 2) |
53 | return -EINVAL; | 55 | return -EINVAL; |
54 | 56 | ||
@@ -60,6 +62,10 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids, | |||
60 | dynid->id.idVendor = idVendor; | 62 | dynid->id.idVendor = idVendor; |
61 | dynid->id.idProduct = idProduct; | 63 | dynid->id.idProduct = idProduct; |
62 | dynid->id.match_flags = USB_DEVICE_ID_MATCH_DEVICE; | 64 | dynid->id.match_flags = USB_DEVICE_ID_MATCH_DEVICE; |
65 | if (fields == 3) { | ||
66 | dynid->id.bInterfaceClass = (u8)bInterfaceClass; | ||
67 | dynid->id.match_flags |= USB_DEVICE_ID_MATCH_INT_CLASS; | ||
68 | } | ||
63 | 69 | ||
64 | spin_lock(&dynids->lock); | 70 | spin_lock(&dynids->lock); |
65 | list_add_tail(&dynid->node, &dynids->list); | 71 | list_add_tail(&dynid->node, &dynids->list); |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index a004db35f6d0..d136b8f4c8a7 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -453,10 +453,6 @@ static int resume_common(struct device *dev, int event) | |||
453 | 453 | ||
454 | pci_set_master(pci_dev); | 454 | pci_set_master(pci_dev); |
455 | 455 | ||
456 | clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); | ||
457 | if (hcd->shared_hcd) | ||
458 | clear_bit(HCD_FLAG_SAW_IRQ, &hcd->shared_hcd->flags); | ||
459 | |||
460 | if (hcd->driver->pci_resume && !HCD_DEAD(hcd)) { | 456 | if (hcd->driver->pci_resume && !HCD_DEAD(hcd)) { |
461 | if (event != PM_EVENT_AUTO_RESUME) | 457 | if (event != PM_EVENT_AUTO_RESUME) |
462 | wait_for_companions(pci_dev, hcd); | 458 | wait_for_companions(pci_dev, hcd); |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 13222d352a61..eb19cba34ac9 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -658,7 +658,7 @@ error: | |||
658 | len > offsetof(struct usb_device_descriptor, | 658 | len > offsetof(struct usb_device_descriptor, |
659 | bDeviceProtocol)) | 659 | bDeviceProtocol)) |
660 | ((struct usb_device_descriptor *) ubuf)-> | 660 | ((struct usb_device_descriptor *) ubuf)-> |
661 | bDeviceProtocol = 1; | 661 | bDeviceProtocol = USB_HUB_PR_HS_SINGLE_TT; |
662 | } | 662 | } |
663 | 663 | ||
664 | /* any errors get returned through the urb completion */ | 664 | /* any errors get returned through the urb completion */ |
@@ -1168,20 +1168,6 @@ int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb, | |||
1168 | if (urb->unlinked) | 1168 | if (urb->unlinked) |
1169 | return -EBUSY; | 1169 | return -EBUSY; |
1170 | urb->unlinked = status; | 1170 | urb->unlinked = status; |
1171 | |||
1172 | /* IRQ setup can easily be broken so that USB controllers | ||
1173 | * never get completion IRQs ... maybe even the ones we need to | ||
1174 | * finish unlinking the initial failed usb_set_address() | ||
1175 | * or device descriptor fetch. | ||
1176 | */ | ||
1177 | if (!HCD_SAW_IRQ(hcd) && !is_root_hub(urb->dev)) { | ||
1178 | dev_warn(hcd->self.controller, "Unlink after no-IRQ? " | ||
1179 | "Controller is probably using the wrong IRQ.\n"); | ||
1180 | set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); | ||
1181 | if (hcd->shared_hcd) | ||
1182 | set_bit(HCD_FLAG_SAW_IRQ, &hcd->shared_hcd->flags); | ||
1183 | } | ||
1184 | |||
1185 | return 0; | 1171 | return 0; |
1186 | } | 1172 | } |
1187 | EXPORT_SYMBOL_GPL(usb_hcd_check_unlink_urb); | 1173 | EXPORT_SYMBOL_GPL(usb_hcd_check_unlink_urb); |
@@ -1412,11 +1398,10 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, | |||
1412 | ret = -EAGAIN; | 1398 | ret = -EAGAIN; |
1413 | else | 1399 | else |
1414 | urb->transfer_flags |= URB_DMA_MAP_SG; | 1400 | urb->transfer_flags |= URB_DMA_MAP_SG; |
1415 | if (n != urb->num_sgs) { | 1401 | urb->num_mapped_sgs = n; |
1416 | urb->num_sgs = n; | 1402 | if (n != urb->num_sgs) |
1417 | urb->transfer_flags |= | 1403 | urb->transfer_flags |= |
1418 | URB_DMA_SG_COMBINED; | 1404 | URB_DMA_SG_COMBINED; |
1419 | } | ||
1420 | } else if (urb->sg) { | 1405 | } else if (urb->sg) { |
1421 | struct scatterlist *sg = urb->sg; | 1406 | struct scatterlist *sg = urb->sg; |
1422 | urb->transfer_dma = dma_map_page( | 1407 | urb->transfer_dma = dma_map_page( |
@@ -2148,16 +2133,12 @@ irqreturn_t usb_hcd_irq (int irq, void *__hcd) | |||
2148 | */ | 2133 | */ |
2149 | local_irq_save(flags); | 2134 | local_irq_save(flags); |
2150 | 2135 | ||
2151 | if (unlikely(HCD_DEAD(hcd) || !HCD_HW_ACCESSIBLE(hcd))) { | 2136 | if (unlikely(HCD_DEAD(hcd) || !HCD_HW_ACCESSIBLE(hcd))) |
2152 | rc = IRQ_NONE; | 2137 | rc = IRQ_NONE; |
2153 | } else if (hcd->driver->irq(hcd) == IRQ_NONE) { | 2138 | else if (hcd->driver->irq(hcd) == IRQ_NONE) |
2154 | rc = IRQ_NONE; | 2139 | rc = IRQ_NONE; |
2155 | } else { | 2140 | else |
2156 | set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); | ||
2157 | if (hcd->shared_hcd) | ||
2158 | set_bit(HCD_FLAG_SAW_IRQ, &hcd->shared_hcd->flags); | ||
2159 | rc = IRQ_HANDLED; | 2141 | rc = IRQ_HANDLED; |
2160 | } | ||
2161 | 2142 | ||
2162 | local_irq_restore(flags); | 2143 | local_irq_restore(flags); |
2163 | return rc; | 2144 | return rc; |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 79781461eec9..79d339e2e700 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -84,7 +84,7 @@ struct usb_hub { | |||
84 | 84 | ||
85 | static inline int hub_is_superspeed(struct usb_device *hdev) | 85 | static inline int hub_is_superspeed(struct usb_device *hdev) |
86 | { | 86 | { |
87 | return (hdev->descriptor.bDeviceProtocol == 3); | 87 | return (hdev->descriptor.bDeviceProtocol == USB_HUB_PR_SS); |
88 | } | 88 | } |
89 | 89 | ||
90 | /* Protect struct usb_device->state and ->children members | 90 | /* Protect struct usb_device->state and ->children members |
@@ -1041,58 +1041,58 @@ static int hub_configure(struct usb_hub *hub, | |||
1041 | dev_dbg(hub_dev, "standalone hub\n"); | 1041 | dev_dbg(hub_dev, "standalone hub\n"); |
1042 | 1042 | ||
1043 | switch (wHubCharacteristics & HUB_CHAR_LPSM) { | 1043 | switch (wHubCharacteristics & HUB_CHAR_LPSM) { |
1044 | case 0x00: | 1044 | case HUB_CHAR_COMMON_LPSM: |
1045 | dev_dbg(hub_dev, "ganged power switching\n"); | 1045 | dev_dbg(hub_dev, "ganged power switching\n"); |
1046 | break; | 1046 | break; |
1047 | case 0x01: | 1047 | case HUB_CHAR_INDV_PORT_LPSM: |
1048 | dev_dbg(hub_dev, "individual port power switching\n"); | 1048 | dev_dbg(hub_dev, "individual port power switching\n"); |
1049 | break; | 1049 | break; |
1050 | case 0x02: | 1050 | case HUB_CHAR_NO_LPSM: |
1051 | case 0x03: | 1051 | case HUB_CHAR_LPSM: |
1052 | dev_dbg(hub_dev, "no power switching (usb 1.0)\n"); | 1052 | dev_dbg(hub_dev, "no power switching (usb 1.0)\n"); |
1053 | break; | 1053 | break; |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | switch (wHubCharacteristics & HUB_CHAR_OCPM) { | 1056 | switch (wHubCharacteristics & HUB_CHAR_OCPM) { |
1057 | case 0x00: | 1057 | case HUB_CHAR_COMMON_OCPM: |
1058 | dev_dbg(hub_dev, "global over-current protection\n"); | 1058 | dev_dbg(hub_dev, "global over-current protection\n"); |
1059 | break; | 1059 | break; |
1060 | case 0x08: | 1060 | case HUB_CHAR_INDV_PORT_OCPM: |
1061 | dev_dbg(hub_dev, "individual port over-current protection\n"); | 1061 | dev_dbg(hub_dev, "individual port over-current protection\n"); |
1062 | break; | 1062 | break; |
1063 | case 0x10: | 1063 | case HUB_CHAR_NO_OCPM: |
1064 | case 0x18: | 1064 | case HUB_CHAR_OCPM: |
1065 | dev_dbg(hub_dev, "no over-current protection\n"); | 1065 | dev_dbg(hub_dev, "no over-current protection\n"); |
1066 | break; | 1066 | break; |
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | spin_lock_init (&hub->tt.lock); | 1069 | spin_lock_init (&hub->tt.lock); |
1070 | INIT_LIST_HEAD (&hub->tt.clear_list); | 1070 | INIT_LIST_HEAD (&hub->tt.clear_list); |
1071 | INIT_WORK(&hub->tt.clear_work, hub_tt_work); | 1071 | INIT_WORK(&hub->tt.clear_work, hub_tt_work); |
1072 | switch (hdev->descriptor.bDeviceProtocol) { | 1072 | switch (hdev->descriptor.bDeviceProtocol) { |
1073 | case 0: | 1073 | case USB_HUB_PR_FS: |
1074 | break; | 1074 | break; |
1075 | case 1: | 1075 | case USB_HUB_PR_HS_SINGLE_TT: |
1076 | dev_dbg(hub_dev, "Single TT\n"); | 1076 | dev_dbg(hub_dev, "Single TT\n"); |
1077 | hub->tt.hub = hdev; | 1077 | hub->tt.hub = hdev; |
1078 | break; | 1078 | break; |
1079 | case 2: | 1079 | case USB_HUB_PR_HS_MULTI_TT: |
1080 | ret = usb_set_interface(hdev, 0, 1); | 1080 | ret = usb_set_interface(hdev, 0, 1); |
1081 | if (ret == 0) { | 1081 | if (ret == 0) { |
1082 | dev_dbg(hub_dev, "TT per port\n"); | 1082 | dev_dbg(hub_dev, "TT per port\n"); |
1083 | hub->tt.multi = 1; | 1083 | hub->tt.multi = 1; |
1084 | } else | 1084 | } else |
1085 | dev_err(hub_dev, "Using single TT (err %d)\n", | 1085 | dev_err(hub_dev, "Using single TT (err %d)\n", |
1086 | ret); | 1086 | ret); |
1087 | hub->tt.hub = hdev; | 1087 | hub->tt.hub = hdev; |
1088 | break; | 1088 | break; |
1089 | case 3: | 1089 | case USB_HUB_PR_SS: |
1090 | /* USB 3.0 hubs don't have a TT */ | 1090 | /* USB 3.0 hubs don't have a TT */ |
1091 | break; | 1091 | break; |
1092 | default: | 1092 | default: |
1093 | dev_dbg(hub_dev, "Unrecognized hub protocol %d\n", | 1093 | dev_dbg(hub_dev, "Unrecognized hub protocol %d\n", |
1094 | hdev->descriptor.bDeviceProtocol); | 1094 | hdev->descriptor.bDeviceProtocol); |
1095 | break; | 1095 | break; |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | /* Note 8 FS bit times == (8 bits / 12000000 bps) ~= 666ns */ | 1098 | /* Note 8 FS bit times == (8 bits / 12000000 bps) ~= 666ns */ |
@@ -1360,7 +1360,6 @@ descriptor_error: | |||
1360 | return -ENODEV; | 1360 | return -ENODEV; |
1361 | } | 1361 | } |
1362 | 1362 | ||
1363 | /* No BKL needed */ | ||
1364 | static int | 1363 | static int |
1365 | hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data) | 1364 | hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data) |
1366 | { | 1365 | { |
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 3888778582c4..45e8479c377d 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h | |||
@@ -132,20 +132,6 @@ static inline int is_usb_device_driver(struct device_driver *drv) | |||
132 | for_devices; | 132 | for_devices; |
133 | } | 133 | } |
134 | 134 | ||
135 | /* translate USB error codes to codes user space understands */ | ||
136 | static inline int usb_translate_errors(int error_code) | ||
137 | { | ||
138 | switch (error_code) { | ||
139 | case 0: | ||
140 | case -ENOMEM: | ||
141 | case -ENODEV: | ||
142 | return error_code; | ||
143 | default: | ||
144 | return -EIO; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | |||
149 | /* for labeling diagnostics */ | 135 | /* for labeling diagnostics */ |
150 | extern const char *usbcore_name; | 136 | extern const char *usbcore_name; |
151 | 137 | ||
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 5809bf413d76..3274ac8f1200 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -394,9 +394,9 @@ static struct platform_driver dwc3_omap_driver = { | |||
394 | }, | 394 | }, |
395 | }; | 395 | }; |
396 | 396 | ||
397 | module_platform_driver(dwc3_omap_driver); | ||
398 | |||
397 | MODULE_ALIAS("platform:omap-dwc3"); | 399 | MODULE_ALIAS("platform:omap-dwc3"); |
398 | MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); | 400 | MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); |
399 | MODULE_LICENSE("Dual BSD/GPL"); | 401 | MODULE_LICENSE("Dual BSD/GPL"); |
400 | MODULE_DESCRIPTION("DesignWare USB3 OMAP Glue Layer"); | 402 | MODULE_DESCRIPTION("DesignWare USB3 OMAP Glue Layer"); |
401 | |||
402 | module_platform_driver(dwc3_omap_driver); | ||
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index d64072c06ef3..71108c26c562 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | menuconfig USB_GADGET | 16 | menuconfig USB_GADGET |
17 | tristate "USB Gadget Support" | 17 | tristate "USB Gadget Support" |
18 | select NLS | ||
18 | help | 19 | help |
19 | USB is a master/slave protocol, organized with one master | 20 | USB is a master/slave protocol, organized with one master |
20 | host (such as a PC) controlling up to 127 peripheral devices. | 21 | host (such as a PC) controlling up to 127 peripheral devices. |
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c index e00cf92409ce..f75c56a259a9 100644 --- a/drivers/usb/gadget/fsl_qe_udc.c +++ b/drivers/usb/gadget/fsl_qe_udc.c | |||
@@ -2814,20 +2814,7 @@ static struct platform_driver udc_driver = { | |||
2814 | #endif | 2814 | #endif |
2815 | }; | 2815 | }; |
2816 | 2816 | ||
2817 | static int __init qe_udc_init(void) | 2817 | module_platform_driver(udc_driver); |
2818 | { | ||
2819 | printk(KERN_INFO "%s: %s, %s\n", driver_name, driver_desc, | ||
2820 | DRIVER_VERSION); | ||
2821 | return platform_driver_register(&udc_driver); | ||
2822 | } | ||
2823 | |||
2824 | static void __exit qe_udc_exit(void) | ||
2825 | { | ||
2826 | platform_driver_unregister(&udc_driver); | ||
2827 | } | ||
2828 | |||
2829 | module_init(qe_udc_init); | ||
2830 | module_exit(qe_udc_exit); | ||
2831 | 2818 | ||
2832 | MODULE_DESCRIPTION(DRIVER_DESC); | 2819 | MODULE_DESCRIPTION(DRIVER_DESC); |
2833 | MODULE_AUTHOR(DRIVER_AUTHOR); | 2820 | MODULE_AUTHOR(DRIVER_AUTHOR); |
diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c index 892412103dd8..0114fd33fbe2 100644 --- a/drivers/usb/gadget/mv_udc_core.c +++ b/drivers/usb/gadget/mv_udc_core.c | |||
@@ -2463,24 +2463,11 @@ static struct platform_driver udc_driver = { | |||
2463 | #endif | 2463 | #endif |
2464 | }, | 2464 | }, |
2465 | }; | 2465 | }; |
2466 | MODULE_ALIAS("platform:pxa-u2o"); | 2466 | |
2467 | module_platform_driver(udc_driver); | ||
2467 | 2468 | ||
2468 | MODULE_DESCRIPTION(DRIVER_DESC); | 2469 | MODULE_DESCRIPTION(DRIVER_DESC); |
2469 | MODULE_AUTHOR("Chao Xie <chao.xie@marvell.com>"); | 2470 | MODULE_AUTHOR("Chao Xie <chao.xie@marvell.com>"); |
2470 | MODULE_VERSION(DRIVER_VERSION); | 2471 | MODULE_VERSION(DRIVER_VERSION); |
2471 | MODULE_LICENSE("GPL"); | 2472 | MODULE_LICENSE("GPL"); |
2472 | 2473 | MODULE_ALIAS("platform:pxa-u2o"); | |
2473 | |||
2474 | static int __init init(void) | ||
2475 | { | ||
2476 | return platform_driver_register(&udc_driver); | ||
2477 | } | ||
2478 | module_init(init); | ||
2479 | |||
2480 | |||
2481 | static void __exit cleanup(void) | ||
2482 | { | ||
2483 | platform_driver_unregister(&udc_driver); | ||
2484 | } | ||
2485 | module_exit(cleanup); | ||
2486 | |||
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index b31448229f0b..c59156c0061d 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -3467,18 +3467,7 @@ static struct platform_driver s3c_hsotg_driver = { | |||
3467 | .resume = s3c_hsotg_resume, | 3467 | .resume = s3c_hsotg_resume, |
3468 | }; | 3468 | }; |
3469 | 3469 | ||
3470 | static int __init s3c_hsotg_modinit(void) | 3470 | module_platform_driver(s3c_hsotg_driver); |
3471 | { | ||
3472 | return platform_driver_register(&s3c_hsotg_driver); | ||
3473 | } | ||
3474 | |||
3475 | static void __exit s3c_hsotg_modexit(void) | ||
3476 | { | ||
3477 | platform_driver_unregister(&s3c_hsotg_driver); | ||
3478 | } | ||
3479 | |||
3480 | module_init(s3c_hsotg_modinit); | ||
3481 | module_exit(s3c_hsotg_modexit); | ||
3482 | 3471 | ||
3483 | MODULE_DESCRIPTION("Samsung S3C USB High-speed/OtG device"); | 3472 | MODULE_DESCRIPTION("Samsung S3C USB High-speed/OtG device"); |
3484 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | 3473 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); |
diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c index 20a553b46aed..787ac5baae92 100644 --- a/drivers/usb/gadget/s3c-hsudc.c +++ b/drivers/usb/gadget/s3c-hsudc.c | |||
@@ -1377,21 +1377,10 @@ static struct platform_driver s3c_hsudc_driver = { | |||
1377 | }, | 1377 | }, |
1378 | .probe = s3c_hsudc_probe, | 1378 | .probe = s3c_hsudc_probe, |
1379 | }; | 1379 | }; |
1380 | MODULE_ALIAS("platform:s3c-hsudc"); | ||
1381 | |||
1382 | static int __init s3c_hsudc_modinit(void) | ||
1383 | { | ||
1384 | return platform_driver_register(&s3c_hsudc_driver); | ||
1385 | } | ||
1386 | 1380 | ||
1387 | static void __exit s3c_hsudc_modexit(void) | 1381 | module_platform_driver(s3c_hsudc_driver); |
1388 | { | ||
1389 | platform_driver_unregister(&s3c_hsudc_driver); | ||
1390 | } | ||
1391 | |||
1392 | module_init(s3c_hsudc_modinit); | ||
1393 | module_exit(s3c_hsudc_modexit); | ||
1394 | 1382 | ||
1395 | MODULE_DESCRIPTION("Samsung S3C24XX USB high-speed controller driver"); | 1383 | MODULE_DESCRIPTION("Samsung S3C24XX USB high-speed controller driver"); |
1396 | MODULE_AUTHOR("Thomas Abraham <thomas.ab@samsung.com>"); | 1384 | MODULE_AUTHOR("Thomas Abraham <thomas.ab@samsung.com>"); |
1397 | MODULE_LICENSE("GPL"); | 1385 | MODULE_LICENSE("GPL"); |
1386 | MODULE_ALIAS("platform:s3c-hsudc"); | ||
diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c index 58c4d37d312a..4d25b9009edf 100644 --- a/drivers/usb/gadget/usbstring.c +++ b/drivers/usb/gadget/usbstring.c | |||
@@ -13,82 +13,17 @@ | |||
13 | #include <linux/string.h> | 13 | #include <linux/string.h> |
14 | #include <linux/device.h> | 14 | #include <linux/device.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/nls.h> | ||
16 | 17 | ||
17 | #include <linux/usb/ch9.h> | 18 | #include <linux/usb/ch9.h> |
18 | #include <linux/usb/gadget.h> | 19 | #include <linux/usb/gadget.h> |
19 | 20 | ||
20 | #include <asm/unaligned.h> | ||
21 | |||
22 | |||
23 | static int utf8_to_utf16le(const char *s, __le16 *cp, unsigned len) | ||
24 | { | ||
25 | int count = 0; | ||
26 | u8 c; | ||
27 | u16 uchar; | ||
28 | |||
29 | /* this insists on correct encodings, though not minimal ones. | ||
30 | * BUT it currently rejects legit 4-byte UTF-8 code points, | ||
31 | * which need surrogate pairs. (Unicode 3.1 can use them.) | ||
32 | */ | ||
33 | while (len != 0 && (c = (u8) *s++) != 0) { | ||
34 | if (unlikely(c & 0x80)) { | ||
35 | // 2-byte sequence: | ||
36 | // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx | ||
37 | if ((c & 0xe0) == 0xc0) { | ||
38 | uchar = (c & 0x1f) << 6; | ||
39 | |||
40 | c = (u8) *s++; | ||
41 | if ((c & 0xc0) != 0x80) | ||
42 | goto fail; | ||
43 | c &= 0x3f; | ||
44 | uchar |= c; | ||
45 | |||
46 | // 3-byte sequence (most CJKV characters): | ||
47 | // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx | ||
48 | } else if ((c & 0xf0) == 0xe0) { | ||
49 | uchar = (c & 0x0f) << 12; | ||
50 | |||
51 | c = (u8) *s++; | ||
52 | if ((c & 0xc0) != 0x80) | ||
53 | goto fail; | ||
54 | c &= 0x3f; | ||
55 | uchar |= c << 6; | ||
56 | |||
57 | c = (u8) *s++; | ||
58 | if ((c & 0xc0) != 0x80) | ||
59 | goto fail; | ||
60 | c &= 0x3f; | ||
61 | uchar |= c; | ||
62 | |||
63 | /* no bogus surrogates */ | ||
64 | if (0xd800 <= uchar && uchar <= 0xdfff) | ||
65 | goto fail; | ||
66 | |||
67 | // 4-byte sequence (surrogate pairs, currently rare): | ||
68 | // 11101110wwwwzzzzyy + 110111yyyyxxxxxx | ||
69 | // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx | ||
70 | // (uuuuu = wwww + 1) | ||
71 | // FIXME accept the surrogate code points (only) | ||
72 | |||
73 | } else | ||
74 | goto fail; | ||
75 | } else | ||
76 | uchar = c; | ||
77 | put_unaligned_le16(uchar, cp++); | ||
78 | count++; | ||
79 | len--; | ||
80 | } | ||
81 | return count; | ||
82 | fail: | ||
83 | return -1; | ||
84 | } | ||
85 | |||
86 | 21 | ||
87 | /** | 22 | /** |
88 | * usb_gadget_get_string - fill out a string descriptor | 23 | * usb_gadget_get_string - fill out a string descriptor |
89 | * @table: of c strings encoded using UTF-8 | 24 | * @table: of c strings encoded using UTF-8 |
90 | * @id: string id, from low byte of wValue in get string descriptor | 25 | * @id: string id, from low byte of wValue in get string descriptor |
91 | * @buf: at least 256 bytes | 26 | * @buf: at least 256 bytes, must be 16-bit aligned |
92 | * | 27 | * |
93 | * Finds the UTF-8 string matching the ID, and converts it into a | 28 | * Finds the UTF-8 string matching the ID, and converts it into a |
94 | * string descriptor in utf16-le. | 29 | * string descriptor in utf16-le. |
@@ -125,8 +60,8 @@ usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf) | |||
125 | 60 | ||
126 | /* string descriptors have length, tag, then UTF16-LE text */ | 61 | /* string descriptors have length, tag, then UTF16-LE text */ |
127 | len = min ((size_t) 126, strlen (s->s)); | 62 | len = min ((size_t) 126, strlen (s->s)); |
128 | memset (buf + 2, 0, 2 * len); /* zero all the bytes */ | 63 | len = utf8s_to_utf16s(s->s, len, UTF16_LITTLE_ENDIAN, |
129 | len = utf8_to_utf16le(s->s, (__le16 *)&buf[2], len); | 64 | (wchar_t *) &buf[2], 126); |
130 | if (len < 0) | 65 | if (len < 0) |
131 | return -EINVAL; | 66 | return -EINVAL; |
132 | buf [0] = (len + 1) * 2; | 67 | buf [0] = (len + 1) * 2; |
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index 18bafa99fe57..bf7441afed16 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -23,6 +23,7 @@ static int au1xxx_ehci_setup(struct usb_hcd *hcd) | |||
23 | int ret = ehci_init(hcd); | 23 | int ret = ehci_init(hcd); |
24 | 24 | ||
25 | ehci->need_io_watchdog = 0; | 25 | ehci->need_io_watchdog = 0; |
26 | ehci_reset(ehci); | ||
26 | return ret; | 27 | return ret; |
27 | } | 28 | } |
28 | 29 | ||
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 3ff9f82f7263..c4c76ab204c1 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -48,6 +48,10 @@ | |||
48 | #include <asm/system.h> | 48 | #include <asm/system.h> |
49 | #include <asm/unaligned.h> | 49 | #include <asm/unaligned.h> |
50 | 50 | ||
51 | #if defined(CONFIG_PPC_PS3) | ||
52 | #include <asm/firmware.h> | ||
53 | #endif | ||
54 | |||
51 | /*-------------------------------------------------------------------------*/ | 55 | /*-------------------------------------------------------------------------*/ |
52 | 56 | ||
53 | /* | 57 | /* |
@@ -230,12 +234,58 @@ static int ehci_halt (struct ehci_hcd *ehci) | |||
230 | STS_HALT, STS_HALT, 16 * 125); | 234 | STS_HALT, STS_HALT, 16 * 125); |
231 | } | 235 | } |
232 | 236 | ||
237 | #if defined(CONFIG_USB_SUSPEND) && defined(CONFIG_PPC_PS3) | ||
238 | |||
239 | /* | ||
240 | * The EHCI controller of the Cell Super Companion Chip used in the | ||
241 | * PS3 will stop the root hub after all root hub ports are suspended. | ||
242 | * When in this condition handshake will return -ETIMEDOUT. The | ||
243 | * STS_HLT bit will not be set, so inspection of the frame index is | ||
244 | * used here to test for the condition. If the condition is found | ||
245 | * return success to allow the USB suspend to complete. | ||
246 | */ | ||
247 | |||
248 | static int handshake_for_broken_root_hub(struct ehci_hcd *ehci, | ||
249 | void __iomem *ptr, u32 mask, u32 done, | ||
250 | int usec) | ||
251 | { | ||
252 | unsigned int old_index; | ||
253 | int error; | ||
254 | |||
255 | if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) | ||
256 | return -ETIMEDOUT; | ||
257 | |||
258 | old_index = ehci_read_frame_index(ehci); | ||
259 | |||
260 | error = handshake(ehci, ptr, mask, done, usec); | ||
261 | |||
262 | if (error == -ETIMEDOUT && ehci_read_frame_index(ehci) == old_index) | ||
263 | return 0; | ||
264 | |||
265 | return error; | ||
266 | } | ||
267 | |||
268 | #else | ||
269 | |||
270 | static int handshake_for_broken_root_hub(struct ehci_hcd *ehci, | ||
271 | void __iomem *ptr, u32 mask, u32 done, | ||
272 | int usec) | ||
273 | { | ||
274 | return -ETIMEDOUT; | ||
275 | } | ||
276 | |||
277 | #endif | ||
278 | |||
233 | static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr, | 279 | static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr, |
234 | u32 mask, u32 done, int usec) | 280 | u32 mask, u32 done, int usec) |
235 | { | 281 | { |
236 | int error; | 282 | int error; |
237 | 283 | ||
238 | error = handshake(ehci, ptr, mask, done, usec); | 284 | error = handshake(ehci, ptr, mask, done, usec); |
285 | if (error == -ETIMEDOUT) | ||
286 | error = handshake_for_broken_root_hub(ehci, ptr, mask, done, | ||
287 | usec); | ||
288 | |||
239 | if (error) { | 289 | if (error) { |
240 | ehci_halt(ehci); | 290 | ehci_halt(ehci); |
241 | ehci->rh_state = EHCI_RH_HALTED; | 291 | ehci->rh_state = EHCI_RH_HALTED; |
@@ -620,6 +670,7 @@ static int ehci_init(struct usb_hcd *hcd) | |||
620 | hw = ehci->async->hw; | 670 | hw = ehci->async->hw; |
621 | hw->hw_next = QH_NEXT(ehci, ehci->async->qh_dma); | 671 | hw->hw_next = QH_NEXT(ehci, ehci->async->qh_dma); |
622 | hw->hw_info1 = cpu_to_hc32(ehci, QH_HEAD); | 672 | hw->hw_info1 = cpu_to_hc32(ehci, QH_HEAD); |
673 | hw->hw_info1 |= cpu_to_hc32(ehci, (1 << 7)); /* I = 1 */ | ||
623 | hw->hw_token = cpu_to_hc32(ehci, QTD_STS_HALT); | 674 | hw->hw_token = cpu_to_hc32(ehci, QTD_STS_HALT); |
624 | hw->hw_qtd_next = EHCI_LIST_END(ehci); | 675 | hw->hw_qtd_next = EHCI_LIST_END(ehci); |
625 | ehci->async->qh_state = QH_STATE_LINKED; | 676 | ehci->async->qh_state = QH_STATE_LINKED; |
@@ -677,22 +728,13 @@ static int ehci_init(struct usb_hcd *hcd) | |||
677 | static int ehci_run (struct usb_hcd *hcd) | 728 | static int ehci_run (struct usb_hcd *hcd) |
678 | { | 729 | { |
679 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 730 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
680 | int retval; | ||
681 | u32 temp; | 731 | u32 temp; |
682 | u32 hcc_params; | 732 | u32 hcc_params; |
683 | 733 | ||
684 | hcd->uses_new_polling = 1; | 734 | hcd->uses_new_polling = 1; |
685 | 735 | ||
686 | /* EHCI spec section 4.1 */ | 736 | /* EHCI spec section 4.1 */ |
687 | /* | 737 | |
688 | * TDI driver does the ehci_reset in their reset callback. | ||
689 | * Don't reset here, because configuration settings will | ||
690 | * vanish. | ||
691 | */ | ||
692 | if (!ehci_is_TDI(ehci) && (retval = ehci_reset(ehci)) != 0) { | ||
693 | ehci_mem_cleanup(ehci); | ||
694 | return retval; | ||
695 | } | ||
696 | ehci_writel(ehci, ehci->periodic_dma, &ehci->regs->frame_list); | 738 | ehci_writel(ehci, ehci->periodic_dma, &ehci->regs->frame_list); |
697 | ehci_writel(ehci, (u32)ehci->async->qh_dma, &ehci->regs->async_next); | 739 | ehci_writel(ehci, (u32)ehci->async->qh_dma, &ehci->regs->async_next); |
698 | 740 | ||
@@ -1324,7 +1366,7 @@ MODULE_LICENSE ("GPL"); | |||
1324 | #define PLATFORM_DRIVER ehci_pxa168_driver | 1366 | #define PLATFORM_DRIVER ehci_pxa168_driver |
1325 | #endif | 1367 | #endif |
1326 | 1368 | ||
1327 | #ifdef CONFIG_NLM_XLR | 1369 | #ifdef CONFIG_CPU_XLR |
1328 | #include "ehci-xls.c" | 1370 | #include "ehci-xls.c" |
1329 | #define PLATFORM_DRIVER ehci_xls_driver | 1371 | #define PLATFORM_DRIVER ehci_xls_driver |
1330 | #endif | 1372 | #endif |
diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c index ba1f51361134..c0104882c72d 100644 --- a/drivers/usb/host/ehci-octeon.c +++ b/drivers/usb/host/ehci-octeon.c | |||
@@ -155,6 +155,8 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev) | |||
155 | /* cache this readonly data; minimize chip reads */ | 155 | /* cache this readonly data; minimize chip reads */ |
156 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | 156 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
157 | 157 | ||
158 | ehci_reset(ehci); | ||
159 | |||
158 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); | 160 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); |
159 | if (ret) { | 161 | if (ret) { |
160 | dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret); | 162 | dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret); |
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index e39b0297bad1..e33baf9052cb 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
@@ -228,6 +228,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
228 | /* cache this readonly data; minimize chip reads */ | 228 | /* cache this readonly data; minimize chip reads */ |
229 | omap_ehci->hcs_params = readl(&omap_ehci->caps->hcs_params); | 229 | omap_ehci->hcs_params = readl(&omap_ehci->caps->hcs_params); |
230 | 230 | ||
231 | ehci_reset(omap_ehci); | ||
232 | |||
231 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); | 233 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); |
232 | if (ret) { | 234 | if (ret) { |
233 | dev_err(dev, "failed to add hcd with err %d\n", ret); | 235 | dev_err(dev, "failed to add hcd with err %d\n", ret); |
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c index 2dc32da75cfc..a20e496eb479 100644 --- a/drivers/usb/host/ehci-ps3.c +++ b/drivers/usb/host/ehci-ps3.c | |||
@@ -21,6 +21,34 @@ | |||
21 | #include <asm/firmware.h> | 21 | #include <asm/firmware.h> |
22 | #include <asm/ps3.h> | 22 | #include <asm/ps3.h> |
23 | 23 | ||
24 | static void ps3_ehci_setup_insnreg(struct ehci_hcd *ehci) | ||
25 | { | ||
26 | /* PS3 HC internal setup register offsets. */ | ||
27 | |||
28 | enum ps3_ehci_hc_insnreg { | ||
29 | ps3_ehci_hc_insnreg01 = 0x084, | ||
30 | ps3_ehci_hc_insnreg02 = 0x088, | ||
31 | ps3_ehci_hc_insnreg03 = 0x08c, | ||
32 | }; | ||
33 | |||
34 | /* PS3 EHCI HC errata fix 316 - The PS3 EHCI HC will reset its | ||
35 | * internal INSNREGXX setup regs back to the chip default values | ||
36 | * on Host Controller Reset (CMD_RESET) or Light Host Controller | ||
37 | * Reset (CMD_LRESET). The work-around for this is for the HC | ||
38 | * driver to re-initialise these regs when ever the HC is reset. | ||
39 | */ | ||
40 | |||
41 | /* Set burst transfer counts to 256 out, 32 in. */ | ||
42 | |||
43 | writel_be(0x01000020, (void __iomem *)ehci->regs + | ||
44 | ps3_ehci_hc_insnreg01); | ||
45 | |||
46 | /* Enable burst transfer counts. */ | ||
47 | |||
48 | writel_be(0x00000001, (void __iomem *)ehci->regs + | ||
49 | ps3_ehci_hc_insnreg03); | ||
50 | } | ||
51 | |||
24 | static int ps3_ehci_hc_reset(struct usb_hcd *hcd) | 52 | static int ps3_ehci_hc_reset(struct usb_hcd *hcd) |
25 | { | 53 | { |
26 | int result; | 54 | int result; |
@@ -49,6 +77,8 @@ static int ps3_ehci_hc_reset(struct usb_hcd *hcd) | |||
49 | 77 | ||
50 | ehci_reset(ehci); | 78 | ehci_reset(ehci); |
51 | 79 | ||
80 | ps3_ehci_setup_insnreg(ehci); | ||
81 | |||
52 | return result; | 82 | return result; |
53 | } | 83 | } |
54 | 84 | ||
diff --git a/drivers/usb/host/ehci-pxa168.c b/drivers/usb/host/ehci-pxa168.c index ac0c16e8f539..8d0e7a22e711 100644 --- a/drivers/usb/host/ehci-pxa168.c +++ b/drivers/usb/host/ehci-pxa168.c | |||
@@ -299,7 +299,7 @@ static int __devinit ehci_pxa168_drv_probe(struct platform_device *pdev) | |||
299 | ehci = hcd_to_ehci(hcd); | 299 | ehci = hcd_to_ehci(hcd); |
300 | ehci->caps = hcd->regs + 0x100; | 300 | ehci->caps = hcd->regs + 0x100; |
301 | ehci->regs = hcd->regs + 0x100 + | 301 | ehci->regs = hcd->regs + 0x100 + |
302 | HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); | 302 | HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase)); |
303 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | 303 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
304 | hcd->has_tt = 1; | 304 | hcd->has_tt = 1; |
305 | ehci->sbrn = 0x20; | 305 | ehci->sbrn = 0x20; |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 4e4066c35a09..36ca5077cdf7 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -373,6 +373,17 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
373 | retry_xacterr: | 373 | retry_xacterr: |
374 | if ((token & QTD_STS_ACTIVE) == 0) { | 374 | if ((token & QTD_STS_ACTIVE) == 0) { |
375 | 375 | ||
376 | /* Report Data Buffer Error: non-fatal but useful */ | ||
377 | if (token & QTD_STS_DBE) | ||
378 | ehci_dbg(ehci, | ||
379 | "detected DataBufferErr for urb %p ep%d%s len %d, qtd %p [qh %p]\n", | ||
380 | urb, | ||
381 | usb_endpoint_num(&urb->ep->desc), | ||
382 | usb_endpoint_dir_in(&urb->ep->desc) ? "in" : "out", | ||
383 | urb->transfer_buffer_length, | ||
384 | qtd, | ||
385 | qh); | ||
386 | |||
376 | /* on STALL, error, and short reads this urb must | 387 | /* on STALL, error, and short reads this urb must |
377 | * complete and all its qtds must be recycled. | 388 | * complete and all its qtds must be recycled. |
378 | */ | 389 | */ |
@@ -647,7 +658,7 @@ qh_urb_transaction ( | |||
647 | /* | 658 | /* |
648 | * data transfer stage: buffer setup | 659 | * data transfer stage: buffer setup |
649 | */ | 660 | */ |
650 | i = urb->num_sgs; | 661 | i = urb->num_mapped_sgs; |
651 | if (len > 0 && i > 0) { | 662 | if (len > 0 && i > 0) { |
652 | sg = urb->sg; | 663 | sg = urb->sg; |
653 | buf = sg_dma_address(sg); | 664 | buf = sg_dma_address(sg); |
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c index 024b65c4990d..293f7412992e 100644 --- a/drivers/usb/host/ehci-s5p.c +++ b/drivers/usb/host/ehci-s5p.c | |||
@@ -14,8 +14,6 @@ | |||
14 | 14 | ||
15 | #include <linux/clk.h> | 15 | #include <linux/clk.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <mach/regs-pmu.h> | ||
18 | #include <plat/cpu.h> | ||
19 | #include <plat/ehci.h> | 17 | #include <plat/ehci.h> |
20 | #include <plat/usb-phy.h> | 18 | #include <plat/usb-phy.h> |
21 | 19 | ||
@@ -136,6 +134,8 @@ static int __devinit s5p_ehci_probe(struct platform_device *pdev) | |||
136 | /* cache this readonly data; minimize chip reads */ | 134 | /* cache this readonly data; minimize chip reads */ |
137 | ehci->hcs_params = readl(&ehci->caps->hcs_params); | 135 | ehci->hcs_params = readl(&ehci->caps->hcs_params); |
138 | 136 | ||
137 | ehci_reset(ehci); | ||
138 | |||
139 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); | 139 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); |
140 | if (err) { | 140 | if (err) { |
141 | dev_err(&pdev->dev, "Failed to add USB HCD\n"); | 141 | dev_err(&pdev->dev, "Failed to add USB HCD\n"); |
diff --git a/drivers/usb/host/ehci-vt8500.c b/drivers/usb/host/ehci-vt8500.c index 54d1ab8aec49..c1eda73916cd 100644 --- a/drivers/usb/host/ehci-vt8500.c +++ b/drivers/usb/host/ehci-vt8500.c | |||
@@ -132,6 +132,8 @@ static int vt8500_ehci_drv_probe(struct platform_device *pdev) | |||
132 | 132 | ||
133 | ehci_port_power(ehci, 1); | 133 | ehci_port_power(ehci, 1); |
134 | 134 | ||
135 | ehci_reset(ehci); | ||
136 | |||
135 | ret = usb_add_hcd(hcd, pdev->resource[1].start, | 137 | ret = usb_add_hcd(hcd, pdev->resource[1].start, |
136 | IRQF_SHARED); | 138 | IRQF_SHARED); |
137 | if (ret == 0) { | 139 | if (ret == 0) { |
diff --git a/drivers/usb/host/ehci-w90x900.c b/drivers/usb/host/ehci-w90x900.c index d661cf7de140..3d2e26cbb34c 100644 --- a/drivers/usb/host/ehci-w90x900.c +++ b/drivers/usb/host/ehci-w90x900.c | |||
@@ -78,6 +78,8 @@ static int __devinit usb_w90x900_probe(const struct hc_driver *driver, | |||
78 | if (irq < 0) | 78 | if (irq < 0) |
79 | goto err4; | 79 | goto err4; |
80 | 80 | ||
81 | ehci_reset(ehci); | ||
82 | |||
81 | retval = usb_add_hcd(hcd, irq, IRQF_SHARED); | 83 | retval = usb_add_hcd(hcd, irq, IRQF_SHARED); |
82 | if (retval != 0) | 84 | if (retval != 0) |
83 | goto err4; | 85 | goto err4; |
diff --git a/drivers/usb/host/ehci-xls.c b/drivers/usb/host/ehci-xls.c index b4fb511d24bc..72f08196f8cd 100644 --- a/drivers/usb/host/ehci-xls.c +++ b/drivers/usb/host/ehci-xls.c | |||
@@ -69,7 +69,7 @@ int ehci_xls_probe_internal(const struct hc_driver *driver, | |||
69 | } | 69 | } |
70 | 70 | ||
71 | hcd->rsrc_start = res->start; | 71 | hcd->rsrc_start = res->start; |
72 | hcd->rsrc_len = res->end - res->start + 1; | 72 | hcd->rsrc_len = resource_size(res); |
73 | 73 | ||
74 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, | 74 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, |
75 | driver->description)) { | 75 | driver->description)) { |
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c index 4ed6d19f2a54..d2623747b489 100644 --- a/drivers/usb/host/fhci-hcd.c +++ b/drivers/usb/host/fhci-hcd.c | |||
@@ -824,17 +824,7 @@ static struct platform_driver of_fhci_driver = { | |||
824 | .remove = __devexit_p(of_fhci_remove), | 824 | .remove = __devexit_p(of_fhci_remove), |
825 | }; | 825 | }; |
826 | 826 | ||
827 | static int __init fhci_module_init(void) | 827 | module_platform_driver(of_fhci_driver); |
828 | { | ||
829 | return platform_driver_register(&of_fhci_driver); | ||
830 | } | ||
831 | module_init(fhci_module_init); | ||
832 | |||
833 | static void __exit fhci_module_exit(void) | ||
834 | { | ||
835 | platform_driver_unregister(&of_fhci_driver); | ||
836 | } | ||
837 | module_exit(fhci_module_exit); | ||
838 | 828 | ||
839 | MODULE_DESCRIPTION("USB Freescale Host Controller Interface Driver"); | 829 | MODULE_DESCRIPTION("USB Freescale Host Controller Interface Driver"); |
840 | MODULE_AUTHOR("Shlomi Gridish <gridish@freescale.com>, " | 830 | MODULE_AUTHOR("Shlomi Gridish <gridish@freescale.com>, " |
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index 9037035ad1e4..7916e56a725e 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c | |||
@@ -297,17 +297,7 @@ static struct platform_driver fsl_usb2_mph_dr_driver = { | |||
297 | .remove = __devexit_p(fsl_usb2_mph_dr_of_remove), | 297 | .remove = __devexit_p(fsl_usb2_mph_dr_of_remove), |
298 | }; | 298 | }; |
299 | 299 | ||
300 | static int __init fsl_usb2_mph_dr_init(void) | 300 | module_platform_driver(fsl_usb2_mph_dr_driver); |
301 | { | ||
302 | return platform_driver_register(&fsl_usb2_mph_dr_driver); | ||
303 | } | ||
304 | module_init(fsl_usb2_mph_dr_init); | ||
305 | |||
306 | static void __exit fsl_usb2_mph_dr_exit(void) | ||
307 | { | ||
308 | platform_driver_unregister(&fsl_usb2_mph_dr_driver); | ||
309 | } | ||
310 | module_exit(fsl_usb2_mph_dr_exit); | ||
311 | 301 | ||
312 | MODULE_DESCRIPTION("FSL MPH DR OF devices driver"); | 302 | MODULE_DESCRIPTION("FSL MPH DR OF devices driver"); |
313 | MODULE_AUTHOR("Anatolij Gustschin <agust@denx.de>"); | 303 | MODULE_AUTHOR("Anatolij Gustschin <agust@denx.de>"); |
diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c index 9bfac657572e..565d79f06e6f 100644 --- a/drivers/usb/host/hwa-hc.c +++ b/drivers/usb/host/hwa-hc.c | |||
@@ -776,7 +776,6 @@ static int hwahc_probe(struct usb_interface *usb_iface, | |||
776 | goto error_alloc; | 776 | goto error_alloc; |
777 | } | 777 | } |
778 | usb_hcd->wireless = 1; | 778 | usb_hcd->wireless = 1; |
779 | set_bit(HCD_FLAG_SAW_IRQ, &usb_hcd->flags); | ||
780 | wusbhc = usb_hcd_to_wusbhc(usb_hcd); | 779 | wusbhc = usb_hcd_to_wusbhc(usb_hcd); |
781 | hwahc = container_of(wusbhc, struct hwahc, wusbhc); | 780 | hwahc = container_of(wusbhc, struct hwahc, wusbhc); |
782 | hwahc_init(hwahc); | 781 | hwahc_init(hwahc); |
diff --git a/drivers/usb/host/imx21-hcd.c b/drivers/usb/host/imx21-hcd.c index 2ee18cfa1efe..6923bcb8aa68 100644 --- a/drivers/usb/host/imx21-hcd.c +++ b/drivers/usb/host/imx21-hcd.c | |||
@@ -1924,18 +1924,7 @@ static struct platform_driver imx21_hcd_driver = { | |||
1924 | .resume = NULL, | 1924 | .resume = NULL, |
1925 | }; | 1925 | }; |
1926 | 1926 | ||
1927 | static int __init imx21_hcd_init(void) | 1927 | module_platform_driver(imx21_hcd_driver); |
1928 | { | ||
1929 | return platform_driver_register(&imx21_hcd_driver); | ||
1930 | } | ||
1931 | |||
1932 | static void __exit imx21_hcd_cleanup(void) | ||
1933 | { | ||
1934 | platform_driver_unregister(&imx21_hcd_driver); | ||
1935 | } | ||
1936 | |||
1937 | module_init(imx21_hcd_init); | ||
1938 | module_exit(imx21_hcd_cleanup); | ||
1939 | 1928 | ||
1940 | MODULE_DESCRIPTION("i.MX21 USB Host controller"); | 1929 | MODULE_DESCRIPTION("i.MX21 USB Host controller"); |
1941 | MODULE_AUTHOR("Martin Fuzzey"); | 1930 | MODULE_AUTHOR("Martin Fuzzey"); |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index 27dfab80ed8f..fc72d44bf787 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -32,6 +32,13 @@ static struct kmem_cache *qtd_cachep; | |||
32 | static struct kmem_cache *qh_cachep; | 32 | static struct kmem_cache *qh_cachep; |
33 | static struct kmem_cache *urb_listitem_cachep; | 33 | static struct kmem_cache *urb_listitem_cachep; |
34 | 34 | ||
35 | enum queue_head_types { | ||
36 | QH_CONTROL, | ||
37 | QH_BULK, | ||
38 | QH_INTERRUPT, | ||
39 | QH_END | ||
40 | }; | ||
41 | |||
35 | struct isp1760_hcd { | 42 | struct isp1760_hcd { |
36 | u32 hcs_params; | 43 | u32 hcs_params; |
37 | spinlock_t lock; | 44 | spinlock_t lock; |
@@ -40,7 +47,7 @@ struct isp1760_hcd { | |||
40 | struct slotinfo int_slots[32]; | 47 | struct slotinfo int_slots[32]; |
41 | int int_done_map; | 48 | int int_done_map; |
42 | struct memory_chunk memory_pool[BLOCKS]; | 49 | struct memory_chunk memory_pool[BLOCKS]; |
43 | struct list_head controlqhs, bulkqhs, interruptqhs; | 50 | struct list_head qh_list[QH_END]; |
44 | 51 | ||
45 | /* periodic schedule support */ | 52 | /* periodic schedule support */ |
46 | #define DEFAULT_I_TDPS 1024 | 53 | #define DEFAULT_I_TDPS 1024 |
@@ -406,12 +413,12 @@ static int priv_init(struct usb_hcd *hcd) | |||
406 | { | 413 | { |
407 | struct isp1760_hcd *priv = hcd_to_priv(hcd); | 414 | struct isp1760_hcd *priv = hcd_to_priv(hcd); |
408 | u32 hcc_params; | 415 | u32 hcc_params; |
416 | int i; | ||
409 | 417 | ||
410 | spin_lock_init(&priv->lock); | 418 | spin_lock_init(&priv->lock); |
411 | 419 | ||
412 | INIT_LIST_HEAD(&priv->interruptqhs); | 420 | for (i = 0; i < QH_END; i++) |
413 | INIT_LIST_HEAD(&priv->controlqhs); | 421 | INIT_LIST_HEAD(&priv->qh_list[i]); |
414 | INIT_LIST_HEAD(&priv->bulkqhs); | ||
415 | 422 | ||
416 | /* | 423 | /* |
417 | * hw default: 1K periodic list heads, one per frame. | 424 | * hw default: 1K periodic list heads, one per frame. |
@@ -930,9 +937,9 @@ void schedule_ptds(struct usb_hcd *hcd) | |||
930 | struct isp1760_hcd *priv; | 937 | struct isp1760_hcd *priv; |
931 | struct isp1760_qh *qh, *qh_next; | 938 | struct isp1760_qh *qh, *qh_next; |
932 | struct list_head *ep_queue; | 939 | struct list_head *ep_queue; |
933 | struct usb_host_endpoint *ep; | ||
934 | LIST_HEAD(urb_list); | 940 | LIST_HEAD(urb_list); |
935 | struct urb_listitem *urb_listitem, *urb_listitem_next; | 941 | struct urb_listitem *urb_listitem, *urb_listitem_next; |
942 | int i; | ||
936 | 943 | ||
937 | if (!hcd) { | 944 | if (!hcd) { |
938 | WARN_ON(1); | 945 | WARN_ON(1); |
@@ -944,28 +951,13 @@ void schedule_ptds(struct usb_hcd *hcd) | |||
944 | /* | 951 | /* |
945 | * check finished/retired xfers, transfer payloads, call urb_done() | 952 | * check finished/retired xfers, transfer payloads, call urb_done() |
946 | */ | 953 | */ |
947 | ep_queue = &priv->interruptqhs; | 954 | for (i = 0; i < QH_END; i++) { |
948 | while (ep_queue) { | 955 | ep_queue = &priv->qh_list[i]; |
949 | list_for_each_entry_safe(qh, qh_next, ep_queue, qh_list) { | 956 | list_for_each_entry_safe(qh, qh_next, ep_queue, qh_list) { |
950 | ep = list_entry(qh->qtd_list.next, struct isp1760_qtd, | ||
951 | qtd_list)->urb->ep; | ||
952 | collect_qtds(hcd, qh, &urb_list); | 957 | collect_qtds(hcd, qh, &urb_list); |
953 | if (list_empty(&qh->qtd_list)) { | 958 | if (list_empty(&qh->qtd_list)) |
954 | list_del(&qh->qh_list); | 959 | list_del(&qh->qh_list); |
955 | if (ep->hcpriv == NULL) { | ||
956 | /* Endpoint has been disabled, so we | ||
957 | can free the associated queue head. */ | ||
958 | qh_free(qh); | ||
959 | } | ||
960 | } | ||
961 | } | 960 | } |
962 | |||
963 | if (ep_queue == &priv->interruptqhs) | ||
964 | ep_queue = &priv->controlqhs; | ||
965 | else if (ep_queue == &priv->controlqhs) | ||
966 | ep_queue = &priv->bulkqhs; | ||
967 | else | ||
968 | ep_queue = NULL; | ||
969 | } | 961 | } |
970 | 962 | ||
971 | list_for_each_entry_safe(urb_listitem, urb_listitem_next, &urb_list, | 963 | list_for_each_entry_safe(urb_listitem, urb_listitem_next, &urb_list, |
@@ -998,17 +990,10 @@ void schedule_ptds(struct usb_hcd *hcd) | |||
998 | * | 990 | * |
999 | * I'm sure this scheme could be improved upon! | 991 | * I'm sure this scheme could be improved upon! |
1000 | */ | 992 | */ |
1001 | ep_queue = &priv->controlqhs; | 993 | for (i = 0; i < QH_END; i++) { |
1002 | while (ep_queue) { | 994 | ep_queue = &priv->qh_list[i]; |
1003 | list_for_each_entry_safe(qh, qh_next, ep_queue, qh_list) | 995 | list_for_each_entry_safe(qh, qh_next, ep_queue, qh_list) |
1004 | enqueue_qtds(hcd, qh); | 996 | enqueue_qtds(hcd, qh); |
1005 | |||
1006 | if (ep_queue == &priv->controlqhs) | ||
1007 | ep_queue = &priv->interruptqhs; | ||
1008 | else if (ep_queue == &priv->interruptqhs) | ||
1009 | ep_queue = &priv->bulkqhs; | ||
1010 | else | ||
1011 | ep_queue = NULL; | ||
1012 | } | 997 | } |
1013 | } | 998 | } |
1014 | 999 | ||
@@ -1543,16 +1528,16 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
1543 | 1528 | ||
1544 | switch (usb_pipetype(urb->pipe)) { | 1529 | switch (usb_pipetype(urb->pipe)) { |
1545 | case PIPE_CONTROL: | 1530 | case PIPE_CONTROL: |
1546 | ep_queue = &priv->controlqhs; | 1531 | ep_queue = &priv->qh_list[QH_CONTROL]; |
1547 | break; | 1532 | break; |
1548 | case PIPE_BULK: | 1533 | case PIPE_BULK: |
1549 | ep_queue = &priv->bulkqhs; | 1534 | ep_queue = &priv->qh_list[QH_BULK]; |
1550 | break; | 1535 | break; |
1551 | case PIPE_INTERRUPT: | 1536 | case PIPE_INTERRUPT: |
1552 | if (urb->interval < 0) | 1537 | if (urb->interval < 0) |
1553 | return -EINVAL; | 1538 | return -EINVAL; |
1554 | /* FIXME: Check bandwidth */ | 1539 | /* FIXME: Check bandwidth */ |
1555 | ep_queue = &priv->interruptqhs; | 1540 | ep_queue = &priv->qh_list[QH_INTERRUPT]; |
1556 | break; | 1541 | break; |
1557 | case PIPE_ISOCHRONOUS: | 1542 | case PIPE_ISOCHRONOUS: |
1558 | dev_err(hcd->self.controller, "%s: isochronous USB packets " | 1543 | dev_err(hcd->self.controller, "%s: isochronous USB packets " |
@@ -1714,8 +1699,8 @@ static void isp1760_endpoint_disable(struct usb_hcd *hcd, | |||
1714 | { | 1699 | { |
1715 | struct isp1760_hcd *priv = hcd_to_priv(hcd); | 1700 | struct isp1760_hcd *priv = hcd_to_priv(hcd); |
1716 | unsigned long spinflags; | 1701 | unsigned long spinflags; |
1717 | struct isp1760_qh *qh; | 1702 | struct isp1760_qh *qh, *qh_iter; |
1718 | struct isp1760_qtd *qtd; | 1703 | int i; |
1719 | 1704 | ||
1720 | spin_lock_irqsave(&priv->lock, spinflags); | 1705 | spin_lock_irqsave(&priv->lock, spinflags); |
1721 | 1706 | ||
@@ -1723,14 +1708,17 @@ static void isp1760_endpoint_disable(struct usb_hcd *hcd, | |||
1723 | if (!qh) | 1708 | if (!qh) |
1724 | goto out; | 1709 | goto out; |
1725 | 1710 | ||
1726 | list_for_each_entry(qtd, &qh->qtd_list, qtd_list) | 1711 | WARN_ON(!list_empty(&qh->qtd_list)); |
1727 | if (qtd->status != QTD_RETIRE) { | ||
1728 | dequeue_urb_from_qtd(hcd, qh, qtd); | ||
1729 | qtd->urb->status = -ECONNRESET; | ||
1730 | } | ||
1731 | 1712 | ||
1713 | for (i = 0; i < QH_END; i++) | ||
1714 | list_for_each_entry(qh_iter, &priv->qh_list[i], qh_list) | ||
1715 | if (qh_iter == qh) { | ||
1716 | list_del(&qh_iter->qh_list); | ||
1717 | i = QH_END; | ||
1718 | break; | ||
1719 | } | ||
1720 | qh_free(qh); | ||
1732 | ep->hcpriv = NULL; | 1721 | ep->hcpriv = NULL; |
1733 | /* Cannot free qh here since it will be parsed by schedule_ptds() */ | ||
1734 | 1722 | ||
1735 | schedule_ptds(hcd); | 1723 | schedule_ptds(hcd); |
1736 | 1724 | ||
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index a7dc1e1d45f2..b605224fb9e3 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c | |||
@@ -47,9 +47,9 @@ static int of_isp1760_probe(struct platform_device *dev) | |||
47 | int virq; | 47 | int virq; |
48 | resource_size_t res_len; | 48 | resource_size_t res_len; |
49 | int ret; | 49 | int ret; |
50 | const unsigned int *prop; | ||
51 | unsigned int devflags = 0; | 50 | unsigned int devflags = 0; |
52 | enum of_gpio_flags gpio_flags; | 51 | enum of_gpio_flags gpio_flags; |
52 | u32 bus_width = 0; | ||
53 | 53 | ||
54 | drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); | 54 | drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); |
55 | if (!drvdata) | 55 | if (!drvdata) |
@@ -77,8 +77,8 @@ static int of_isp1760_probe(struct platform_device *dev) | |||
77 | devflags |= ISP1760_FLAG_ISP1761; | 77 | devflags |= ISP1760_FLAG_ISP1761; |
78 | 78 | ||
79 | /* Some systems wire up only 16 of the 32 data lines */ | 79 | /* Some systems wire up only 16 of the 32 data lines */ |
80 | prop = of_get_property(dp, "bus-width", NULL); | 80 | of_property_read_u32(dp, "bus-width", &bus_width); |
81 | if (prop && *prop == 16) | 81 | if (bus_width == 16) |
82 | devflags |= ISP1760_FLAG_BUS_WIDTH_16; | 82 | devflags |= ISP1760_FLAG_BUS_WIDTH_16; |
83 | 83 | ||
84 | if (of_get_property(dp, "port1-otg", NULL) != NULL) | 84 | if (of_get_property(dp, "port1-otg", NULL) != NULL) |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index 9b66df8278f3..40d886adff53 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -173,12 +173,9 @@ static int ohci_hcd_au1xxx_drv_suspend(struct device *dev) | |||
173 | * mark HW unaccessible, bail out if RH has been resumed. Use | 173 | * mark HW unaccessible, bail out if RH has been resumed. Use |
174 | * the spinlock to properly synchronize with possible pending | 174 | * the spinlock to properly synchronize with possible pending |
175 | * RH suspend or resume activity. | 175 | * RH suspend or resume activity. |
176 | * | ||
177 | * This is still racy as hcd->state is manipulated outside of | ||
178 | * any locks =P But that will be a different fix. | ||
179 | */ | 176 | */ |
180 | spin_lock_irqsave(&ohci->lock, flags); | 177 | spin_lock_irqsave(&ohci->lock, flags); |
181 | if (hcd->state != HC_STATE_SUSPENDED) { | 178 | if (ohci->rh_state != OHCI_RH_SUSPENDED) { |
182 | rc = -EINVAL; | 179 | rc = -EINVAL; |
183 | goto bail; | 180 | goto bail; |
184 | } | 181 | } |
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c index d7d34492934a..5179fcd73d8a 100644 --- a/drivers/usb/host/ohci-dbg.c +++ b/drivers/usb/host/ohci-dbg.c | |||
@@ -127,6 +127,19 @@ static char *hcfs2string (int state) | |||
127 | return "?"; | 127 | return "?"; |
128 | } | 128 | } |
129 | 129 | ||
130 | static const char *rh_state_string(struct ohci_hcd *ohci) | ||
131 | { | ||
132 | switch (ohci->rh_state) { | ||
133 | case OHCI_RH_HALTED: | ||
134 | return "halted"; | ||
135 | case OHCI_RH_SUSPENDED: | ||
136 | return "suspended"; | ||
137 | case OHCI_RH_RUNNING: | ||
138 | return "running"; | ||
139 | } | ||
140 | return "?"; | ||
141 | } | ||
142 | |||
130 | // dump control and status registers | 143 | // dump control and status registers |
131 | static void | 144 | static void |
132 | ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size) | 145 | ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size) |
@@ -136,9 +149,10 @@ ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size) | |||
136 | 149 | ||
137 | temp = ohci_readl (controller, ®s->revision) & 0xff; | 150 | temp = ohci_readl (controller, ®s->revision) & 0xff; |
138 | ohci_dbg_sw (controller, next, size, | 151 | ohci_dbg_sw (controller, next, size, |
139 | "OHCI %d.%d, %s legacy support registers\n", | 152 | "OHCI %d.%d, %s legacy support registers, rh state %s\n", |
140 | 0x03 & (temp >> 4), (temp & 0x0f), | 153 | 0x03 & (temp >> 4), (temp & 0x0f), |
141 | (temp & 0x0100) ? "with" : "NO"); | 154 | (temp & 0x0100) ? "with" : "NO", |
155 | rh_state_string(controller)); | ||
142 | 156 | ||
143 | temp = ohci_readl (controller, ®s->control); | 157 | temp = ohci_readl (controller, ®s->control); |
144 | ohci_dbg_sw (controller, next, size, | 158 | ohci_dbg_sw (controller, next, size, |
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index dc45d489d00e..3d63574d2c7e 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c | |||
@@ -179,8 +179,6 @@ static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_ | |||
179 | ohci->next_statechange = jiffies; | 179 | ohci->next_statechange = jiffies; |
180 | 180 | ||
181 | ep93xx_stop_hc(&pdev->dev); | 181 | ep93xx_stop_hc(&pdev->dev); |
182 | hcd->state = HC_STATE_SUSPENDED; | ||
183 | |||
184 | return 0; | 182 | return 0; |
185 | } | 183 | } |
186 | 184 | ||
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index b2639191549e..4fa5d8c4d239 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -209,7 +209,7 @@ static int ohci_urb_enqueue ( | |||
209 | retval = -ENODEV; | 209 | retval = -ENODEV; |
210 | goto fail; | 210 | goto fail; |
211 | } | 211 | } |
212 | if (!HC_IS_RUNNING(hcd->state)) { | 212 | if (ohci->rh_state != OHCI_RH_RUNNING) { |
213 | retval = -ENODEV; | 213 | retval = -ENODEV; |
214 | goto fail; | 214 | goto fail; |
215 | } | 215 | } |
@@ -274,7 +274,7 @@ static int ohci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
274 | rc = usb_hcd_check_unlink_urb(hcd, urb, status); | 274 | rc = usb_hcd_check_unlink_urb(hcd, urb, status); |
275 | if (rc) { | 275 | if (rc) { |
276 | ; /* Do nothing */ | 276 | ; /* Do nothing */ |
277 | } else if (HC_IS_RUNNING(hcd->state)) { | 277 | } else if (ohci->rh_state == OHCI_RH_RUNNING) { |
278 | urb_priv_t *urb_priv; | 278 | urb_priv_t *urb_priv; |
279 | 279 | ||
280 | /* Unless an IRQ completed the unlink while it was being | 280 | /* Unless an IRQ completed the unlink while it was being |
@@ -321,7 +321,7 @@ ohci_endpoint_disable (struct usb_hcd *hcd, struct usb_host_endpoint *ep) | |||
321 | rescan: | 321 | rescan: |
322 | spin_lock_irqsave (&ohci->lock, flags); | 322 | spin_lock_irqsave (&ohci->lock, flags); |
323 | 323 | ||
324 | if (!HC_IS_RUNNING (hcd->state)) { | 324 | if (ohci->rh_state != OHCI_RH_RUNNING) { |
325 | sanitize: | 325 | sanitize: |
326 | ed->state = ED_IDLE; | 326 | ed->state = ED_IDLE; |
327 | if (quirk_zfmicro(ohci) && ed->type == PIPE_INTERRUPT) | 327 | if (quirk_zfmicro(ohci) && ed->type == PIPE_INTERRUPT) |
@@ -377,6 +377,7 @@ static void ohci_usb_reset (struct ohci_hcd *ohci) | |||
377 | ohci->hc_control = ohci_readl (ohci, &ohci->regs->control); | 377 | ohci->hc_control = ohci_readl (ohci, &ohci->regs->control); |
378 | ohci->hc_control &= OHCI_CTRL_RWC; | 378 | ohci->hc_control &= OHCI_CTRL_RWC; |
379 | ohci_writel (ohci, ohci->hc_control, &ohci->regs->control); | 379 | ohci_writel (ohci, ohci->hc_control, &ohci->regs->control); |
380 | ohci->rh_state = OHCI_RH_HALTED; | ||
380 | } | 381 | } |
381 | 382 | ||
382 | /* ohci_shutdown forcibly disables IRQs and DMA, helping kexec and | 383 | /* ohci_shutdown forcibly disables IRQs and DMA, helping kexec and |
@@ -500,7 +501,7 @@ static int ohci_init (struct ohci_hcd *ohci) | |||
500 | if (distrust_firmware) | 501 | if (distrust_firmware) |
501 | ohci->flags |= OHCI_QUIRK_HUB_POWER; | 502 | ohci->flags |= OHCI_QUIRK_HUB_POWER; |
502 | 503 | ||
503 | disable (ohci); | 504 | ohci->rh_state = OHCI_RH_HALTED; |
504 | ohci->regs = hcd->regs; | 505 | ohci->regs = hcd->regs; |
505 | 506 | ||
506 | /* REVISIT this BIOS handshake is now moved into PCI "quirks", and | 507 | /* REVISIT this BIOS handshake is now moved into PCI "quirks", and |
@@ -575,7 +576,7 @@ static int ohci_run (struct ohci_hcd *ohci) | |||
575 | int first = ohci->fminterval == 0; | 576 | int first = ohci->fminterval == 0; |
576 | struct usb_hcd *hcd = ohci_to_hcd(ohci); | 577 | struct usb_hcd *hcd = ohci_to_hcd(ohci); |
577 | 578 | ||
578 | disable (ohci); | 579 | ohci->rh_state = OHCI_RH_HALTED; |
579 | 580 | ||
580 | /* boot firmware should have set this up (5.1.1.3.1) */ | 581 | /* boot firmware should have set this up (5.1.1.3.1) */ |
581 | if (first) { | 582 | if (first) { |
@@ -688,7 +689,7 @@ retry: | |||
688 | ohci->hc_control &= OHCI_CTRL_RWC; | 689 | ohci->hc_control &= OHCI_CTRL_RWC; |
689 | ohci->hc_control |= OHCI_CONTROL_INIT | OHCI_USB_OPER; | 690 | ohci->hc_control |= OHCI_CONTROL_INIT | OHCI_USB_OPER; |
690 | ohci_writel (ohci, ohci->hc_control, &ohci->regs->control); | 691 | ohci_writel (ohci, ohci->hc_control, &ohci->regs->control); |
691 | hcd->state = HC_STATE_RUNNING; | 692 | ohci->rh_state = OHCI_RH_RUNNING; |
692 | 693 | ||
693 | /* wake on ConnectStatusChange, matching external hubs */ | 694 | /* wake on ConnectStatusChange, matching external hubs */ |
694 | ohci_writel (ohci, RH_HS_DRWE, &ohci->regs->roothub.status); | 695 | ohci_writel (ohci, RH_HS_DRWE, &ohci->regs->roothub.status); |
@@ -725,7 +726,6 @@ retry: | |||
725 | 726 | ||
726 | // POTPGT delay is bits 24-31, in 2 ms units. | 727 | // POTPGT delay is bits 24-31, in 2 ms units. |
727 | mdelay ((val >> 23) & 0x1fe); | 728 | mdelay ((val >> 23) & 0x1fe); |
728 | hcd->state = HC_STATE_RUNNING; | ||
729 | 729 | ||
730 | if (quirk_zfmicro(ohci)) { | 730 | if (quirk_zfmicro(ohci)) { |
731 | /* Create timer to watch for bad queue state on ZF Micro */ | 731 | /* Create timer to watch for bad queue state on ZF Micro */ |
@@ -761,7 +761,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd) | |||
761 | * of dead, unclocked, or unplugged (CardBus...) devices | 761 | * of dead, unclocked, or unplugged (CardBus...) devices |
762 | */ | 762 | */ |
763 | if (ints == ~(u32)0) { | 763 | if (ints == ~(u32)0) { |
764 | disable (ohci); | 764 | ohci->rh_state = OHCI_RH_HALTED; |
765 | ohci_dbg (ohci, "device removed!\n"); | 765 | ohci_dbg (ohci, "device removed!\n"); |
766 | usb_hc_died(hcd); | 766 | usb_hc_died(hcd); |
767 | return IRQ_HANDLED; | 767 | return IRQ_HANDLED; |
@@ -771,7 +771,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd) | |||
771 | ints &= ohci_readl(ohci, ®s->intrenable); | 771 | ints &= ohci_readl(ohci, ®s->intrenable); |
772 | 772 | ||
773 | /* interrupt for some other device? */ | 773 | /* interrupt for some other device? */ |
774 | if (ints == 0 || unlikely(hcd->state == HC_STATE_HALT)) | 774 | if (ints == 0 || unlikely(ohci->rh_state == OHCI_RH_HALTED)) |
775 | return IRQ_NOTMINE; | 775 | return IRQ_NOTMINE; |
776 | 776 | ||
777 | if (ints & OHCI_INTR_UE) { | 777 | if (ints & OHCI_INTR_UE) { |
@@ -786,8 +786,8 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd) | |||
786 | 786 | ||
787 | schedule_work (&ohci->nec_work); | 787 | schedule_work (&ohci->nec_work); |
788 | } else { | 788 | } else { |
789 | disable (ohci); | ||
790 | ohci_err (ohci, "OHCI Unrecoverable Error, disabled\n"); | 789 | ohci_err (ohci, "OHCI Unrecoverable Error, disabled\n"); |
790 | ohci->rh_state = OHCI_RH_HALTED; | ||
791 | usb_hc_died(hcd); | 791 | usb_hc_died(hcd); |
792 | } | 792 | } |
793 | 793 | ||
@@ -871,11 +871,11 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd) | |||
871 | if ((ints & OHCI_INTR_SF) != 0 | 871 | if ((ints & OHCI_INTR_SF) != 0 |
872 | && !ohci->ed_rm_list | 872 | && !ohci->ed_rm_list |
873 | && !ohci->ed_to_check | 873 | && !ohci->ed_to_check |
874 | && HC_IS_RUNNING(hcd->state)) | 874 | && ohci->rh_state == OHCI_RH_RUNNING) |
875 | ohci_writel (ohci, OHCI_INTR_SF, ®s->intrdisable); | 875 | ohci_writel (ohci, OHCI_INTR_SF, ®s->intrdisable); |
876 | spin_unlock (&ohci->lock); | 876 | spin_unlock (&ohci->lock); |
877 | 877 | ||
878 | if (HC_IS_RUNNING(hcd->state)) { | 878 | if (ohci->rh_state == OHCI_RH_RUNNING) { |
879 | ohci_writel (ohci, ints, ®s->intrstatus); | 879 | ohci_writel (ohci, ints, ®s->intrstatus); |
880 | ohci_writel (ohci, OHCI_INTR_MIE, ®s->intrenable); | 880 | ohci_writel (ohci, OHCI_INTR_MIE, ®s->intrenable); |
881 | // flush those writes | 881 | // flush those writes |
@@ -929,7 +929,7 @@ static int ohci_restart (struct ohci_hcd *ohci) | |||
929 | struct urb_priv *priv; | 929 | struct urb_priv *priv; |
930 | 930 | ||
931 | spin_lock_irq(&ohci->lock); | 931 | spin_lock_irq(&ohci->lock); |
932 | disable (ohci); | 932 | ohci->rh_state = OHCI_RH_HALTED; |
933 | 933 | ||
934 | /* Recycle any "live" eds/tds (and urbs). */ | 934 | /* Recycle any "live" eds/tds (and urbs). */ |
935 | if (!list_empty (&ohci->pending)) | 935 | if (!list_empty (&ohci->pending)) |
@@ -1111,7 +1111,7 @@ MODULE_LICENSE ("GPL"); | |||
1111 | #define PLATFORM_DRIVER ohci_hcd_ath79_driver | 1111 | #define PLATFORM_DRIVER ohci_hcd_ath79_driver |
1112 | #endif | 1112 | #endif |
1113 | 1113 | ||
1114 | #ifdef CONFIG_NLM_XLR | 1114 | #ifdef CONFIG_CPU_XLR |
1115 | #include "ohci-xls.c" | 1115 | #include "ohci-xls.c" |
1116 | #define PLATFORM_DRIVER ohci_xls_driver | 1116 | #define PLATFORM_DRIVER ohci_xls_driver |
1117 | #endif | 1117 | #endif |
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 2f00040fc408..836772dfabd3 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c | |||
@@ -111,6 +111,7 @@ __acquires(ohci->lock) | |||
111 | if (!autostop) { | 111 | if (!autostop) { |
112 | ohci->next_statechange = jiffies + msecs_to_jiffies (5); | 112 | ohci->next_statechange = jiffies + msecs_to_jiffies (5); |
113 | ohci->autostop = 0; | 113 | ohci->autostop = 0; |
114 | ohci->rh_state = OHCI_RH_SUSPENDED; | ||
114 | } | 115 | } |
115 | 116 | ||
116 | done: | 117 | done: |
@@ -140,7 +141,7 @@ __acquires(ohci->lock) | |||
140 | 141 | ||
141 | if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) { | 142 | if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) { |
142 | /* this can happen after resuming a swsusp snapshot */ | 143 | /* this can happen after resuming a swsusp snapshot */ |
143 | if (hcd->state == HC_STATE_RESUMING) { | 144 | if (ohci->rh_state != OHCI_RH_RUNNING) { |
144 | ohci_dbg (ohci, "BIOS/SMM active, control %03x\n", | 145 | ohci_dbg (ohci, "BIOS/SMM active, control %03x\n", |
145 | ohci->hc_control); | 146 | ohci->hc_control); |
146 | status = -EBUSY; | 147 | status = -EBUSY; |
@@ -274,6 +275,7 @@ skip_resume: | |||
274 | (void) ohci_readl (ohci, &ohci->regs->control); | 275 | (void) ohci_readl (ohci, &ohci->regs->control); |
275 | } | 276 | } |
276 | 277 | ||
278 | ohci->rh_state = OHCI_RH_RUNNING; | ||
277 | return 0; | 279 | return 0; |
278 | } | 280 | } |
279 | 281 | ||
@@ -336,11 +338,8 @@ static void ohci_finish_controller_resume(struct usb_hcd *hcd) | |||
336 | /* If needed, reinitialize and suspend the root hub */ | 338 | /* If needed, reinitialize and suspend the root hub */ |
337 | if (need_reinit) { | 339 | if (need_reinit) { |
338 | spin_lock_irq(&ohci->lock); | 340 | spin_lock_irq(&ohci->lock); |
339 | hcd->state = HC_STATE_RESUMING; | ||
340 | ohci_rh_resume(ohci); | 341 | ohci_rh_resume(ohci); |
341 | hcd->state = HC_STATE_QUIESCING; | ||
342 | ohci_rh_suspend(ohci, 0); | 342 | ohci_rh_suspend(ohci, 0); |
343 | hcd->state = HC_STATE_SUSPENDED; | ||
344 | spin_unlock_irq(&ohci->lock); | 343 | spin_unlock_irq(&ohci->lock); |
345 | } | 344 | } |
346 | 345 | ||
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index e4b8782cc6e2..db3968656d21 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -516,7 +516,6 @@ static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message) | |||
516 | ohci->next_statechange = jiffies; | 516 | ohci->next_statechange = jiffies; |
517 | 517 | ||
518 | omap_ohci_clock_power(0); | 518 | omap_ohci_clock_power(0); |
519 | ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; | ||
520 | return 0; | 519 | return 0; |
521 | } | 520 | } |
522 | 521 | ||
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index bc01b064585a..6109810cc2d3 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -308,12 +308,9 @@ static int ohci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) | |||
308 | * mark HW unaccessible, bail out if RH has been resumed. Use | 308 | * mark HW unaccessible, bail out if RH has been resumed. Use |
309 | * the spinlock to properly synchronize with possible pending | 309 | * the spinlock to properly synchronize with possible pending |
310 | * RH suspend or resume activity. | 310 | * RH suspend or resume activity. |
311 | * | ||
312 | * This is still racy as hcd->state is manipulated outside of | ||
313 | * any locks =P But that will be a different fix. | ||
314 | */ | 311 | */ |
315 | spin_lock_irqsave (&ohci->lock, flags); | 312 | spin_lock_irqsave (&ohci->lock, flags); |
316 | if (hcd->state != HC_STATE_SUSPENDED) { | 313 | if (ohci->rh_state != OHCI_RH_SUSPENDED) { |
317 | rc = -EINVAL; | 314 | rc = -EINVAL; |
318 | goto bail; | 315 | goto bail; |
319 | } | 316 | } |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 29dfefe1c726..6313e4439f37 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -502,8 +502,6 @@ static int ohci_hcd_pxa27x_drv_suspend(struct device *dev) | |||
502 | ohci->ohci.next_statechange = jiffies; | 502 | ohci->ohci.next_statechange = jiffies; |
503 | 503 | ||
504 | pxa27x_stop_hc(ohci, dev); | 504 | pxa27x_stop_hc(ohci, dev); |
505 | hcd->state = HC_STATE_SUSPENDED; | ||
506 | |||
507 | return 0; | 505 | return 0; |
508 | } | 506 | } |
509 | 507 | ||
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index 15dc51ded61a..c5a1ea9145fa 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c | |||
@@ -912,7 +912,7 @@ rescan_all: | |||
912 | /* only take off EDs that the HC isn't using, accounting for | 912 | /* only take off EDs that the HC isn't using, accounting for |
913 | * frame counter wraps and EDs with partially retired TDs | 913 | * frame counter wraps and EDs with partially retired TDs |
914 | */ | 914 | */ |
915 | if (likely (HC_IS_RUNNING(ohci_to_hcd(ohci)->state))) { | 915 | if (likely(ohci->rh_state == OHCI_RH_RUNNING)) { |
916 | if (tick_before (tick, ed->tick)) { | 916 | if (tick_before (tick, ed->tick)) { |
917 | skip_ed: | 917 | skip_ed: |
918 | last = &ed->ed_next; | 918 | last = &ed->ed_next; |
@@ -1012,7 +1012,7 @@ rescan_this: | |||
1012 | 1012 | ||
1013 | /* but if there's work queued, reschedule */ | 1013 | /* but if there's work queued, reschedule */ |
1014 | if (!list_empty (&ed->td_list)) { | 1014 | if (!list_empty (&ed->td_list)) { |
1015 | if (HC_IS_RUNNING(ohci_to_hcd(ohci)->state)) | 1015 | if (ohci->rh_state == OHCI_RH_RUNNING) |
1016 | ed_schedule (ohci, ed); | 1016 | ed_schedule (ohci, ed); |
1017 | } | 1017 | } |
1018 | 1018 | ||
@@ -1021,9 +1021,7 @@ rescan_this: | |||
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | /* maybe reenable control and bulk lists */ | 1023 | /* maybe reenable control and bulk lists */ |
1024 | if (HC_IS_RUNNING(ohci_to_hcd(ohci)->state) | 1024 | if (ohci->rh_state == OHCI_RH_RUNNING && !ohci->ed_rm_list) { |
1025 | && ohci_to_hcd(ohci)->state != HC_STATE_QUIESCING | ||
1026 | && !ohci->ed_rm_list) { | ||
1027 | u32 command = 0, control = 0; | 1025 | u32 command = 0, control = 0; |
1028 | 1026 | ||
1029 | if (ohci->ed_controltail) { | 1027 | if (ohci->ed_controltail) { |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index a1877c47601e..56dcf069246d 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c | |||
@@ -486,15 +486,66 @@ static int __devexit ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev) | |||
486 | return 0; | 486 | return 0; |
487 | } | 487 | } |
488 | 488 | ||
489 | #ifdef CONFIG_PM | ||
490 | static int ohci_hcd_s3c2410_drv_suspend(struct device *dev) | ||
491 | { | ||
492 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
493 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
494 | struct platform_device *pdev = to_platform_device(dev); | ||
495 | unsigned long flags; | ||
496 | int rc = 0; | ||
497 | |||
498 | /* | ||
499 | * Root hub was already suspended. Disable irq emission and | ||
500 | * mark HW unaccessible, bail out if RH has been resumed. Use | ||
501 | * the spinlock to properly synchronize with possible pending | ||
502 | * RH suspend or resume activity. | ||
503 | */ | ||
504 | spin_lock_irqsave(&ohci->lock, flags); | ||
505 | if (ohci->rh_state != OHCI_RH_SUSPENDED) { | ||
506 | rc = -EINVAL; | ||
507 | goto bail; | ||
508 | } | ||
509 | |||
510 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
511 | |||
512 | s3c2410_stop_hc(pdev); | ||
513 | bail: | ||
514 | spin_unlock_irqrestore(&ohci->lock, flags); | ||
515 | |||
516 | return rc; | ||
517 | } | ||
518 | |||
519 | static int ohci_hcd_s3c2410_drv_resume(struct device *dev) | ||
520 | { | ||
521 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
522 | struct platform_device *pdev = to_platform_device(dev); | ||
523 | |||
524 | s3c2410_start_hc(pdev, hcd); | ||
525 | |||
526 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
527 | ohci_finish_controller_resume(hcd); | ||
528 | |||
529 | return 0; | ||
530 | } | ||
531 | #else | ||
532 | #define ohci_hcd_s3c2410_drv_suspend NULL | ||
533 | #define ohci_hcd_s3c2410_drv_resume NULL | ||
534 | #endif | ||
535 | |||
536 | static const struct dev_pm_ops ohci_hcd_s3c2410_pm_ops = { | ||
537 | .suspend = ohci_hcd_s3c2410_drv_suspend, | ||
538 | .resume = ohci_hcd_s3c2410_drv_resume, | ||
539 | }; | ||
540 | |||
489 | static struct platform_driver ohci_hcd_s3c2410_driver = { | 541 | static struct platform_driver ohci_hcd_s3c2410_driver = { |
490 | .probe = ohci_hcd_s3c2410_drv_probe, | 542 | .probe = ohci_hcd_s3c2410_drv_probe, |
491 | .remove = __devexit_p(ohci_hcd_s3c2410_drv_remove), | 543 | .remove = __devexit_p(ohci_hcd_s3c2410_drv_remove), |
492 | .shutdown = usb_hcd_platform_shutdown, | 544 | .shutdown = usb_hcd_platform_shutdown, |
493 | /*.suspend = ohci_hcd_s3c2410_drv_suspend, */ | ||
494 | /*.resume = ohci_hcd_s3c2410_drv_resume, */ | ||
495 | .driver = { | 545 | .driver = { |
496 | .owner = THIS_MODULE, | 546 | .owner = THIS_MODULE, |
497 | .name = "s3c2410-ohci", | 547 | .name = "s3c2410-ohci", |
548 | .pm = &ohci_hcd_s3c2410_pm_ops, | ||
498 | }, | 549 | }, |
499 | }; | 550 | }; |
500 | 551 | ||
diff --git a/drivers/usb/host/ohci-sh.c b/drivers/usb/host/ohci-sh.c index afc4eb6bb9d0..84686d90805b 100644 --- a/drivers/usb/host/ohci-sh.c +++ b/drivers/usb/host/ohci-sh.c | |||
@@ -29,7 +29,6 @@ static int ohci_sh_start(struct usb_hcd *hcd) | |||
29 | ohci_hcd_init(ohci); | 29 | ohci_hcd_init(ohci); |
30 | ohci_init(ohci); | 30 | ohci_init(ohci); |
31 | ohci_run(ohci); | 31 | ohci_run(ohci); |
32 | hcd->state = HC_STATE_RUNNING; | ||
33 | return 0; | 32 | return 0; |
34 | } | 33 | } |
35 | 34 | ||
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index 968cea2b6d4e..5596ac2ba1ca 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c | |||
@@ -224,7 +224,6 @@ static int ohci_sm501_suspend(struct platform_device *pdev, pm_message_t msg) | |||
224 | ohci->next_statechange = jiffies; | 224 | ohci->next_statechange = jiffies; |
225 | 225 | ||
226 | sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0); | 226 | sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0); |
227 | ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; | ||
228 | return 0; | 227 | return 0; |
229 | } | 228 | } |
230 | 229 | ||
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 69874654f3b5..95c16489e883 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c | |||
@@ -203,7 +203,6 @@ static int spear_ohci_hcd_drv_suspend(struct platform_device *dev, | |||
203 | ohci->next_statechange = jiffies; | 203 | ohci->next_statechange = jiffies; |
204 | 204 | ||
205 | spear_stop_ohci(ohci_p); | 205 | spear_stop_ohci(ohci_p); |
206 | ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; | ||
207 | return 0; | 206 | return 0; |
208 | } | 207 | } |
209 | 208 | ||
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c index 06331d931171..120bfe6ede38 100644 --- a/drivers/usb/host/ohci-tmio.c +++ b/drivers/usb/host/ohci-tmio.c | |||
@@ -318,9 +318,6 @@ static int ohci_hcd_tmio_drv_suspend(struct platform_device *dev, pm_message_t s | |||
318 | if (ret) | 318 | if (ret) |
319 | return ret; | 319 | return ret; |
320 | } | 320 | } |
321 | |||
322 | hcd->state = HC_STATE_SUSPENDED; | ||
323 | |||
324 | return 0; | 321 | return 0; |
325 | } | 322 | } |
326 | 323 | ||
diff --git a/drivers/usb/host/ohci-xls.c b/drivers/usb/host/ohci-xls.c index a3a9c6f45b91..a2247867af86 100644 --- a/drivers/usb/host/ohci-xls.c +++ b/drivers/usb/host/ohci-xls.c | |||
@@ -40,7 +40,7 @@ static int ohci_xls_probe_internal(const struct hc_driver *driver, | |||
40 | goto err1; | 40 | goto err1; |
41 | } | 41 | } |
42 | hcd->rsrc_start = res->start; | 42 | hcd->rsrc_start = res->start; |
43 | hcd->rsrc_len = res->end - res->start + 1; | 43 | hcd->rsrc_len = resource_size(res); |
44 | 44 | ||
45 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, | 45 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, |
46 | driver->description)) { | 46 | driver->description)) { |
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index 0795b934d00c..8ff6f7ea96fd 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h | |||
@@ -344,6 +344,12 @@ typedef struct urb_priv { | |||
344 | * a subset of what the full implementation needs. (Linus) | 344 | * a subset of what the full implementation needs. (Linus) |
345 | */ | 345 | */ |
346 | 346 | ||
347 | enum ohci_rh_state { | ||
348 | OHCI_RH_HALTED, | ||
349 | OHCI_RH_SUSPENDED, | ||
350 | OHCI_RH_RUNNING | ||
351 | }; | ||
352 | |||
347 | struct ohci_hcd { | 353 | struct ohci_hcd { |
348 | spinlock_t lock; | 354 | spinlock_t lock; |
349 | 355 | ||
@@ -384,6 +390,7 @@ struct ohci_hcd { | |||
384 | /* | 390 | /* |
385 | * driver state | 391 | * driver state |
386 | */ | 392 | */ |
393 | enum ohci_rh_state rh_state; | ||
387 | int num_ports; | 394 | int num_ports; |
388 | int load [NUM_INTS]; | 395 | int load [NUM_INTS]; |
389 | u32 hc_control; /* copy of hc control reg */ | 396 | u32 hc_control; /* copy of hc control reg */ |
@@ -679,11 +686,6 @@ static inline u16 ohci_hwPSW(const struct ohci_hcd *ohci, | |||
679 | 686 | ||
680 | /*-------------------------------------------------------------------------*/ | 687 | /*-------------------------------------------------------------------------*/ |
681 | 688 | ||
682 | static inline void disable (struct ohci_hcd *ohci) | ||
683 | { | ||
684 | ohci_to_hcd(ohci)->state = HC_STATE_HALT; | ||
685 | } | ||
686 | |||
687 | #define FI 0x2edf /* 12000 bits per frame (-1) */ | 689 | #define FI 0x2edf /* 12000 bits per frame (-1) */ |
688 | #define FSMP(fi) (0x7fff & ((6 * ((fi) - 210)) / 7)) | 690 | #define FSMP(fi) (0x7fff & ((6 * ((fi) - 210)) / 7)) |
689 | #define FIT (1 << 31) | 691 | #define FIT (1 << 31) |
@@ -707,7 +709,7 @@ static inline void periodic_reinit (struct ohci_hcd *ohci) | |||
707 | #define read_roothub(hc, register, mask) ({ \ | 709 | #define read_roothub(hc, register, mask) ({ \ |
708 | u32 temp = ohci_readl (hc, &hc->regs->roothub.register); \ | 710 | u32 temp = ohci_readl (hc, &hc->regs->roothub.register); \ |
709 | if (temp == -1) \ | 711 | if (temp == -1) \ |
710 | disable (hc); \ | 712 | hc->rh_state = OHCI_RH_HALTED; \ |
711 | else if (hc->flags & OHCI_QUIRK_AMD756) \ | 713 | else if (hc->flags & OHCI_QUIRK_AMD756) \ |
712 | while (temp & mask) \ | 714 | while (temp & mask) \ |
713 | temp = ohci_readl (hc, &hc->regs->roothub.register); \ | 715 | temp = ohci_readl (hc, &hc->regs->roothub.register); \ |
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c index dcd889803f0f..6f62de5c6e35 100644 --- a/drivers/usb/host/oxu210hp-hcd.c +++ b/drivers/usb/host/oxu210hp-hcd.c | |||
@@ -3951,24 +3951,7 @@ static struct platform_driver oxu_driver = { | |||
3951 | } | 3951 | } |
3952 | }; | 3952 | }; |
3953 | 3953 | ||
3954 | static int __init oxu_module_init(void) | 3954 | module_platform_driver(oxu_driver); |
3955 | { | ||
3956 | int retval = 0; | ||
3957 | |||
3958 | retval = platform_driver_register(&oxu_driver); | ||
3959 | if (retval < 0) | ||
3960 | return retval; | ||
3961 | |||
3962 | return retval; | ||
3963 | } | ||
3964 | |||
3965 | static void __exit oxu_module_cleanup(void) | ||
3966 | { | ||
3967 | platform_driver_unregister(&oxu_driver); | ||
3968 | } | ||
3969 | |||
3970 | module_init(oxu_module_init); | ||
3971 | module_exit(oxu_module_cleanup); | ||
3972 | 3955 | ||
3973 | MODULE_DESCRIPTION("Oxford OXU210HP HCD driver - ver. " DRIVER_VERSION); | 3956 | MODULE_DESCRIPTION("Oxford OXU210HP HCD driver - ver. " DRIVER_VERSION); |
3974 | MODULE_AUTHOR("Rodolfo Giometti <giometti@linux.it>"); | 3957 | MODULE_AUTHOR("Rodolfo Giometti <giometti@linux.it>"); |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index f6ca80ee4cec..d2c6f5ac4626 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -943,7 +943,7 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb, | |||
943 | if (usb_pipein(urb->pipe)) | 943 | if (usb_pipein(urb->pipe)) |
944 | status |= TD_CTRL_SPD; | 944 | status |= TD_CTRL_SPD; |
945 | 945 | ||
946 | i = urb->num_sgs; | 946 | i = urb->num_mapped_sgs; |
947 | if (len > 0 && i > 0) { | 947 | if (len > 0 && i > 0) { |
948 | sg = urb->sg; | 948 | sg = urb->sg; |
949 | data = sg_dma_address(sg); | 949 | data = sg_dma_address(sg); |
diff --git a/drivers/usb/host/whci/qset.c b/drivers/usb/host/whci/qset.c index a403b53e86b9..76083ae92138 100644 --- a/drivers/usb/host/whci/qset.c +++ b/drivers/usb/host/whci/qset.c | |||
@@ -443,7 +443,7 @@ static int qset_add_urb_sg(struct whc *whc, struct whc_qset *qset, struct urb *u | |||
443 | 443 | ||
444 | remaining = urb->transfer_buffer_length; | 444 | remaining = urb->transfer_buffer_length; |
445 | 445 | ||
446 | for_each_sg(urb->sg, sg, urb->num_sgs, i) { | 446 | for_each_sg(urb->sg, sg, urb->num_mapped_sgs, i) { |
447 | dma_addr_t dma_addr; | 447 | dma_addr_t dma_addr; |
448 | size_t dma_remaining; | 448 | size_t dma_remaining; |
449 | dma_addr_t sp, ep; | 449 | dma_addr_t sp, ep; |
@@ -561,7 +561,7 @@ static int qset_add_urb_sg_linearize(struct whc *whc, struct whc_qset *qset, | |||
561 | 561 | ||
562 | remaining = urb->transfer_buffer_length; | 562 | remaining = urb->transfer_buffer_length; |
563 | 563 | ||
564 | for_each_sg(urb->sg, sg, urb->num_sgs, i) { | 564 | for_each_sg(urb->sg, sg, urb->num_mapped_sgs, i) { |
565 | size_t len; | 565 | size_t len; |
566 | size_t sg_remaining; | 566 | size_t sg_remaining; |
567 | void *orig; | 567 | void *orig; |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 430e88fd3f6c..35e257f79c7b 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -57,17 +57,15 @@ static void xhci_common_hub_descriptor(struct xhci_hcd *xhci, | |||
57 | desc->bHubContrCurrent = 0; | 57 | desc->bHubContrCurrent = 0; |
58 | 58 | ||
59 | desc->bNbrPorts = ports; | 59 | desc->bNbrPorts = ports; |
60 | /* Ugh, these should be #defines, FIXME */ | ||
61 | /* Using table 11-13 in USB 2.0 spec. */ | ||
62 | temp = 0; | 60 | temp = 0; |
63 | /* Bits 1:0 - support port power switching, or power always on */ | 61 | /* Bits 1:0 - support per-port power switching, or power always on */ |
64 | if (HCC_PPC(xhci->hcc_params)) | 62 | if (HCC_PPC(xhci->hcc_params)) |
65 | temp |= 0x0001; | 63 | temp |= HUB_CHAR_INDV_PORT_LPSM; |
66 | else | 64 | else |
67 | temp |= 0x0002; | 65 | temp |= HUB_CHAR_NO_LPSM; |
68 | /* Bit 2 - root hubs are not part of a compound device */ | 66 | /* Bit 2 - root hubs are not part of a compound device */ |
69 | /* Bits 4:3 - individual port over current protection */ | 67 | /* Bits 4:3 - individual port over current protection */ |
70 | temp |= 0x0008; | 68 | temp |= HUB_CHAR_INDV_PORT_OCPM; |
71 | /* Bits 6:5 - no TTs in root ports */ | 69 | /* Bits 6:5 - no TTs in root ports */ |
72 | /* Bit 7 - no port indicators */ | 70 | /* Bit 7 - no port indicators */ |
73 | desc->wHubCharacteristics = cpu_to_le16(temp); | 71 | desc->wHubCharacteristics = cpu_to_le16(temp); |
@@ -86,9 +84,9 @@ static void xhci_usb2_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, | |||
86 | ports = xhci->num_usb2_ports; | 84 | ports = xhci->num_usb2_ports; |
87 | 85 | ||
88 | xhci_common_hub_descriptor(xhci, desc, ports); | 86 | xhci_common_hub_descriptor(xhci, desc, ports); |
89 | desc->bDescriptorType = 0x29; | 87 | desc->bDescriptorType = USB_DT_HUB; |
90 | temp = 1 + (ports / 8); | 88 | temp = 1 + (ports / 8); |
91 | desc->bDescLength = 7 + 2 * temp; | 89 | desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * temp; |
92 | 90 | ||
93 | /* The Device Removable bits are reported on a byte granularity. | 91 | /* The Device Removable bits are reported on a byte granularity. |
94 | * If the port doesn't exist within that byte, the bit is set to 0. | 92 | * If the port doesn't exist within that byte, the bit is set to 0. |
@@ -137,8 +135,8 @@ static void xhci_usb3_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, | |||
137 | 135 | ||
138 | ports = xhci->num_usb3_ports; | 136 | ports = xhci->num_usb3_ports; |
139 | xhci_common_hub_descriptor(xhci, desc, ports); | 137 | xhci_common_hub_descriptor(xhci, desc, ports); |
140 | desc->bDescriptorType = 0x2a; | 138 | desc->bDescriptorType = USB_DT_SS_HUB; |
141 | desc->bDescLength = 12; | 139 | desc->bDescLength = USB_DT_SS_HUB_SIZE; |
142 | 140 | ||
143 | /* header decode latency should be zero for roothubs, | 141 | /* header decode latency should be zero for roothubs, |
144 | * see section 4.23.5.2. | 142 | * see section 4.23.5.2. |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 9f1d4b15d818..d030f0b2bfa2 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -2390,17 +2390,7 @@ hw_died: | |||
2390 | 2390 | ||
2391 | irqreturn_t xhci_msi_irq(int irq, struct usb_hcd *hcd) | 2391 | irqreturn_t xhci_msi_irq(int irq, struct usb_hcd *hcd) |
2392 | { | 2392 | { |
2393 | irqreturn_t ret; | 2393 | return xhci_irq(hcd); |
2394 | struct xhci_hcd *xhci; | ||
2395 | |||
2396 | xhci = hcd_to_xhci(hcd); | ||
2397 | set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); | ||
2398 | if (xhci->shared_hcd) | ||
2399 | set_bit(HCD_FLAG_SAW_IRQ, &xhci->shared_hcd->flags); | ||
2400 | |||
2401 | ret = xhci_irq(hcd); | ||
2402 | |||
2403 | return ret; | ||
2404 | } | 2394 | } |
2405 | 2395 | ||
2406 | /**** Endpoint Ring Operations ****/ | 2396 | /**** Endpoint Ring Operations ****/ |
@@ -2561,7 +2551,7 @@ static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb) | |||
2561 | struct scatterlist *sg; | 2551 | struct scatterlist *sg; |
2562 | 2552 | ||
2563 | sg = NULL; | 2553 | sg = NULL; |
2564 | num_sgs = urb->num_sgs; | 2554 | num_sgs = urb->num_mapped_sgs; |
2565 | temp = urb->transfer_buffer_length; | 2555 | temp = urb->transfer_buffer_length; |
2566 | 2556 | ||
2567 | xhci_dbg(xhci, "count sg list trbs: \n"); | 2557 | xhci_dbg(xhci, "count sg list trbs: \n"); |
@@ -2745,7 +2735,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2745 | return -EINVAL; | 2735 | return -EINVAL; |
2746 | 2736 | ||
2747 | num_trbs = count_sg_trbs_needed(xhci, urb); | 2737 | num_trbs = count_sg_trbs_needed(xhci, urb); |
2748 | num_sgs = urb->num_sgs; | 2738 | num_sgs = urb->num_mapped_sgs; |
2749 | total_packet_count = roundup(urb->transfer_buffer_length, | 2739 | total_packet_count = roundup(urb->transfer_buffer_length, |
2750 | usb_endpoint_maxp(&urb->ep->desc)); | 2740 | usb_endpoint_maxp(&urb->ep->desc)); |
2751 | 2741 | ||
diff --git a/drivers/usb/misc/isight_firmware.c b/drivers/usb/misc/isight_firmware.c index fe1d44319d0a..8f725f651915 100644 --- a/drivers/usb/misc/isight_firmware.c +++ b/drivers/usb/misc/isight_firmware.c | |||
@@ -55,8 +55,9 @@ static int isight_firmware_load(struct usb_interface *intf, | |||
55 | 55 | ||
56 | ptr = firmware->data; | 56 | ptr = firmware->data; |
57 | 57 | ||
58 | buf[0] = 0x01; | ||
58 | if (usb_control_msg | 59 | if (usb_control_msg |
59 | (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\1", 1, | 60 | (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, buf, 1, |
60 | 300) != 1) { | 61 | 300) != 1) { |
61 | printk(KERN_ERR | 62 | printk(KERN_ERR |
62 | "Failed to initialise isight firmware loader\n"); | 63 | "Failed to initialise isight firmware loader\n"); |
@@ -100,8 +101,9 @@ static int isight_firmware_load(struct usb_interface *intf, | |||
100 | } | 101 | } |
101 | } | 102 | } |
102 | 103 | ||
104 | buf[0] = 0x00; | ||
103 | if (usb_control_msg | 105 | if (usb_control_msg |
104 | (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\0", 1, | 106 | (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, buf, 1, |
105 | 300) != 1) { | 107 | 300) != 1) { |
106 | printk(KERN_ERR "isight firmware loading completion failed\n"); | 108 | printk(KERN_ERR "isight firmware loading completion failed\n"); |
107 | ret = -ENODEV; | 109 | ret = -ENODEV; |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index bd6d00802eab..959145baf3cf 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -1765,7 +1765,6 @@ static int test_unaligned_bulk( | |||
1765 | * off just killing the userspace task and waiting for it to exit. | 1765 | * off just killing the userspace task and waiting for it to exit. |
1766 | */ | 1766 | */ |
1767 | 1767 | ||
1768 | /* No BKL needed */ | ||
1769 | static int | 1768 | static int |
1770 | usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf) | 1769 | usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf) |
1771 | { | 1770 | { |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index b63ab1570103..227c1dfa6bee 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -661,7 +661,6 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
661 | 661 | ||
662 | handled = IRQ_HANDLED; | 662 | handled = IRQ_HANDLED; |
663 | musb->is_active = 1; | 663 | musb->is_active = 1; |
664 | set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); | ||
665 | 664 | ||
666 | musb->ep0_stage = MUSB_EP0_START; | 665 | musb->ep0_stage = MUSB_EP0_START; |
667 | 666 | ||
diff --git a/drivers/usb/otg/fsl_otg.c b/drivers/usb/otg/fsl_otg.c index 0f420b25e9a9..2a52ff1b493d 100644 --- a/drivers/usb/otg/fsl_otg.c +++ b/drivers/usb/otg/fsl_otg.c | |||
@@ -1151,18 +1151,7 @@ struct platform_driver fsl_otg_driver = { | |||
1151 | }, | 1151 | }, |
1152 | }; | 1152 | }; |
1153 | 1153 | ||
1154 | static int __init fsl_usb_otg_init(void) | 1154 | module_platform_driver(fsl_otg_driver); |
1155 | { | ||
1156 | pr_info(DRIVER_INFO "\n"); | ||
1157 | return platform_driver_register(&fsl_otg_driver); | ||
1158 | } | ||
1159 | module_init(fsl_usb_otg_init); | ||
1160 | |||
1161 | static void __exit fsl_usb_otg_exit(void) | ||
1162 | { | ||
1163 | platform_driver_unregister(&fsl_otg_driver); | ||
1164 | } | ||
1165 | module_exit(fsl_usb_otg_exit); | ||
1166 | 1155 | ||
1167 | MODULE_DESCRIPTION(DRIVER_INFO); | 1156 | MODULE_DESCRIPTION(DRIVER_INFO); |
1168 | MODULE_AUTHOR(DRIVER_AUTHOR); | 1157 | MODULE_AUTHOR(DRIVER_AUTHOR); |
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index 08c679c0dde5..aa94e33e6885 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c | |||
@@ -637,18 +637,7 @@ static struct platform_driver renesas_usbhs_driver = { | |||
637 | .remove = __devexit_p(usbhs_remove), | 637 | .remove = __devexit_p(usbhs_remove), |
638 | }; | 638 | }; |
639 | 639 | ||
640 | static int __init usbhs_init(void) | 640 | module_platform_driver(renesas_usbhs_driver); |
641 | { | ||
642 | return platform_driver_register(&renesas_usbhs_driver); | ||
643 | } | ||
644 | |||
645 | static void __exit usbhs_exit(void) | ||
646 | { | ||
647 | platform_driver_unregister(&renesas_usbhs_driver); | ||
648 | } | ||
649 | |||
650 | module_init(usbhs_init); | ||
651 | module_exit(usbhs_exit); | ||
652 | 641 | ||
653 | MODULE_LICENSE("GPL"); | 642 | MODULE_LICENSE("GPL"); |
654 | MODULE_DESCRIPTION("Renesas USB driver"); | 643 | MODULE_DESCRIPTION("Renesas USB driver"); |
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c index bade761a1e52..75659e0c735d 100644 --- a/drivers/usb/renesas_usbhs/mod_host.c +++ b/drivers/usb/renesas_usbhs/mod_host.c | |||
@@ -1268,7 +1268,7 @@ int usbhs_mod_host_probe(struct usbhs_priv *priv) | |||
1268 | return -ENOMEM; | 1268 | return -ENOMEM; |
1269 | } | 1269 | } |
1270 | 1270 | ||
1271 | pipe_info = kzalloc(sizeof(*pipe_info) * pipe_size, GFP_KERNEL); | 1271 | pipe_info = kcalloc(pipe_size, sizeof(*pipe_info), GFP_KERNEL); |
1272 | if (!pipe_info) { | 1272 | if (!pipe_info) { |
1273 | dev_err(dev, "Could not allocate pipe_info\n"); | 1273 | dev_err(dev, "Could not allocate pipe_info\n"); |
1274 | goto usbhs_mod_host_probe_err; | 1274 | goto usbhs_mod_host_probe_err; |
diff --git a/drivers/usb/serial/ChangeLog.history b/drivers/usb/serial/ChangeLog.history deleted file mode 100644 index f13fd488ebec..000000000000 --- a/drivers/usb/serial/ChangeLog.history +++ /dev/null | |||
@@ -1,730 +0,0 @@ | |||
1 | This is the contents of some of the drivers/usb/serial/ files that had old | ||
2 | changelog comments. They were quite old, and out of date, and we don't keep | ||
3 | them anymore, so I've put them here, away from the source files, in case | ||
4 | people still care to see them. | ||
5 | |||
6 | - Greg Kroah-Hartman <greg@kroah.com> October 20, 2005 | ||
7 | |||
8 | ----------------------------------------------------------------------- | ||
9 | usb-serial.h Change Log comments: | ||
10 | |||
11 | (03/26/2002) gkh | ||
12 | removed the port->tty check from port_paranoia_check() due to serial | ||
13 | consoles not having a tty device assigned to them. | ||
14 | |||
15 | (12/03/2001) gkh | ||
16 | removed active from the port structure. | ||
17 | added documentation to the usb_serial_device_type structure | ||
18 | |||
19 | (10/10/2001) gkh | ||
20 | added vendor and product to serial structure. Needed to determine device | ||
21 | owner when the device is disconnected. | ||
22 | |||
23 | (05/30/2001) gkh | ||
24 | added sem to port structure and removed port_lock | ||
25 | |||
26 | (10/05/2000) gkh | ||
27 | Added interrupt_in_endpointAddress and bulk_in_endpointAddress to help | ||
28 | fix bug with urb->dev not being set properly, now that the usb core | ||
29 | needs it. | ||
30 | |||
31 | (09/11/2000) gkh | ||
32 | Added usb_serial_debug_data function to help get rid of #DEBUG in the | ||
33 | drivers. | ||
34 | |||
35 | (08/28/2000) gkh | ||
36 | Added port_lock to port structure. | ||
37 | |||
38 | (08/08/2000) gkh | ||
39 | Added open_count to port structure. | ||
40 | |||
41 | (07/23/2000) gkh | ||
42 | Added bulk_out_endpointAddress to port structure. | ||
43 | |||
44 | (07/19/2000) gkh, pberger, and borchers | ||
45 | Modifications to allow usb-serial drivers to be modules. | ||
46 | |||
47 | ----------------------------------------------------------------------- | ||
48 | usb-serial.c Change Log comments: | ||
49 | |||
50 | (12/10/2002) gkh | ||
51 | Split the ports off into their own struct device, and added a | ||
52 | usb-serial bus driver. | ||
53 | |||
54 | (11/19/2002) gkh | ||
55 | removed a few #ifdefs for the generic code and cleaned up the failure | ||
56 | logic in initialization. | ||
57 | |||
58 | (10/02/2002) gkh | ||
59 | moved the console code to console.c and out of this file. | ||
60 | |||
61 | (06/05/2002) gkh | ||
62 | moved location of startup() call in serial_probe() until after all | ||
63 | of the port information and endpoints are initialized. This makes | ||
64 | things easier for some drivers. | ||
65 | |||
66 | (04/10/2002) gkh | ||
67 | added serial_read_proc function which creates a | ||
68 | /proc/tty/driver/usb-serial file. | ||
69 | |||
70 | (03/27/2002) gkh | ||
71 | Got USB serial console code working properly and merged into the main | ||
72 | version of the tree. Thanks to Randy Dunlap for the initial version | ||
73 | of this code, and for pushing me to finish it up. | ||
74 | The USB serial console works with any usb serial driver device. | ||
75 | |||
76 | (03/21/2002) gkh | ||
77 | Moved all manipulation of port->open_count into the core. Now the | ||
78 | individual driver's open and close functions are called only when the | ||
79 | first open() and last close() is called. Making the drivers a bit | ||
80 | smaller and simpler. | ||
81 | Fixed a bug if a driver didn't have the owner field set. | ||
82 | |||
83 | (02/26/2002) gkh | ||
84 | Moved all locking into the main serial_* functions, instead of having | ||
85 | the individual drivers have to grab the port semaphore. This should | ||
86 | reduce races. | ||
87 | Reworked the MOD_INC logic a bit to always increment and decrement, even | ||
88 | if the generic driver is being used. | ||
89 | |||
90 | (10/10/2001) gkh | ||
91 | usb_serial_disconnect() now sets the serial->dev pointer is to NULL to | ||
92 | help prevent child drivers from accessing the device since it is now | ||
93 | gone. | ||
94 | |||
95 | (09/13/2001) gkh | ||
96 | Moved generic driver initialize after we have registered with the USB | ||
97 | core. Thanks to Randy Dunlap for pointing this problem out. | ||
98 | |||
99 | (07/03/2001) gkh | ||
100 | Fixed module paramater size. Thanks to John Brockmeyer for the pointer. | ||
101 | Fixed vendor and product getting defined through the MODULE_PARM macro | ||
102 | if the Generic driver wasn't compiled in. | ||
103 | Fixed problem with generic_shutdown() not being called for drivers that | ||
104 | don't have a shutdown() function. | ||
105 | |||
106 | (06/06/2001) gkh | ||
107 | added evil hack that is needed for the prolific pl2303 device due to the | ||
108 | crazy way its endpoints are set up. | ||
109 | |||
110 | (05/30/2001) gkh | ||
111 | switched from using spinlock to a semaphore, which fixes lots of problems. | ||
112 | |||
113 | (04/08/2001) gb | ||
114 | Identify version on module load. | ||
115 | |||
116 | 2001_02_05 gkh | ||
117 | Fixed buffer overflows bug with the generic serial driver. Thanks to | ||
118 | Todd Squires <squirest@ct0.com> for fixing this. | ||
119 | |||
120 | (01/10/2001) gkh | ||
121 | Fixed bug where the generic serial adaptor grabbed _any_ device that was | ||
122 | offered to it. | ||
123 | |||
124 | (12/12/2000) gkh | ||
125 | Removed MOD_INC and MOD_DEC from poll and disconnect functions, and | ||
126 | moved them to the serial_open and serial_close functions. | ||
127 | Also fixed bug with there not being a MOD_DEC for the generic driver | ||
128 | (thanks to Gary Brubaker for finding this.) | ||
129 | |||
130 | (11/29/2000) gkh | ||
131 | Small NULL pointer initialization cleanup which saves a bit of disk image | ||
132 | |||
133 | (11/01/2000) Adam J. Richter | ||
134 | instead of using idVendor/idProduct pairs, usb serial drivers | ||
135 | now identify their hardware interest with usb_device_id tables, | ||
136 | which they usually have anyhow for use with MODULE_DEVICE_TABLE. | ||
137 | |||
138 | (10/05/2000) gkh | ||
139 | Fixed bug with urb->dev not being set properly, now that the usb | ||
140 | core needs it. | ||
141 | |||
142 | (09/11/2000) gkh | ||
143 | Removed DEBUG #ifdefs with call to usb_serial_debug_data | ||
144 | |||
145 | (08/28/2000) gkh | ||
146 | Added port_lock to port structure. | ||
147 | Added locks for SMP safeness to generic driver | ||
148 | Fixed the ability to open a generic device's port more than once. | ||
149 | |||
150 | (07/23/2000) gkh | ||
151 | Added bulk_out_endpointAddress to port structure. | ||
152 | |||
153 | (07/19/2000) gkh, pberger, and borchers | ||
154 | Modifications to allow usb-serial drivers to be modules. | ||
155 | |||
156 | (07/03/2000) gkh | ||
157 | Added more debugging to serial_ioctl call | ||
158 | |||
159 | (06/25/2000) gkh | ||
160 | Changed generic_write_bulk_callback to not call wake_up_interruptible | ||
161 | directly, but to have port_softint do it at a safer time. | ||
162 | |||
163 | (06/23/2000) gkh | ||
164 | Cleaned up debugging statements in a quest to find UHCI timeout bug. | ||
165 | |||
166 | (05/22/2000) gkh | ||
167 | Changed the makefile, enabling the big CONFIG_USB_SERIAL_SOMTHING to be | ||
168 | removed from the individual device source files. | ||
169 | |||
170 | (05/03/2000) gkh | ||
171 | Added the Digi Acceleport driver from Al Borchers and Peter Berger. | ||
172 | |||
173 | (05/02/2000) gkh | ||
174 | Changed devfs and tty register code to work properly now. This was based on | ||
175 | the ACM driver changes by Vojtech Pavlik. | ||
176 | |||
177 | (04/27/2000) Ryan VanderBijl | ||
178 | Put calls to *_paranoia_checks into one function. | ||
179 | |||
180 | (04/23/2000) gkh | ||
181 | Fixed bug that Randy Dunlap found for Generic devices with no bulk out ports. | ||
182 | Moved when the startup code printed out the devices that are supported. | ||
183 | |||
184 | (04/19/2000) gkh | ||
185 | Added driver for ZyXEL omni.net lcd plus ISDN TA | ||
186 | Made startup info message specify which drivers were compiled in. | ||
187 | |||
188 | (04/03/2000) gkh | ||
189 | Changed the probe process to remove the module unload races. | ||
190 | Changed where the tty layer gets initialized to have devfs work nicer. | ||
191 | Added initial devfs support. | ||
192 | |||
193 | (03/26/2000) gkh | ||
194 | Split driver up into device specific pieces. | ||
195 | |||
196 | (03/19/2000) gkh | ||
197 | Fixed oops that could happen when device was removed while a program | ||
198 | was talking to the device. | ||
199 | Removed the static urbs and now all urbs are created and destroyed | ||
200 | dynamically. | ||
201 | Reworked the internal interface. Now everything is based on the | ||
202 | usb_serial_port structure instead of the larger usb_serial structure. | ||
203 | This fixes the bug that a multiport device could not have more than | ||
204 | one port open at one time. | ||
205 | |||
206 | (03/17/2000) gkh | ||
207 | Added config option for debugging messages. | ||
208 | Added patch for keyspan pda from Brian Warner. | ||
209 | |||
210 | (03/06/2000) gkh | ||
211 | Added the keyspan pda code from Brian Warner <warner@lothar.com> | ||
212 | Moved a bunch of the port specific stuff into its own structure. This | ||
213 | is in anticipation of the true multiport devices (there's a bug if you | ||
214 | try to access more than one port of any multiport device right now) | ||
215 | |||
216 | (02/21/2000) gkh | ||
217 | Made it so that any serial devices only have to specify which functions | ||
218 | they want to overload from the generic function calls (great, | ||
219 | inheritance in C, in a driver, just what I wanted...) | ||
220 | Added support for set_termios and ioctl function calls. No drivers take | ||
221 | advantage of this yet. | ||
222 | Removed the #ifdef MODULE, now there is no module specific code. | ||
223 | Cleaned up a few comments in usb-serial.h that were wrong (thanks again | ||
224 | to Miles Lott). | ||
225 | Small fix to get_free_serial. | ||
226 | |||
227 | (02/14/2000) gkh | ||
228 | Removed the Belkin and Peracom functionality from the driver due to | ||
229 | the lack of support from the vendor, and me not wanting people to | ||
230 | accidenatly buy the device, expecting it to work with Linux. | ||
231 | Added read_bulk_callback and write_bulk_callback to the type structure | ||
232 | for the needs of the FTDI and WhiteHEAT driver. | ||
233 | Changed all reverences to FTDI to FTDI_SIO at the request of Bill | ||
234 | Ryder. | ||
235 | Changed the output urb size back to the max endpoint size to make | ||
236 | the ftdi_sio driver have it easier, and due to the fact that it didn't | ||
237 | really increase the speed any. | ||
238 | |||
239 | (02/11/2000) gkh | ||
240 | Added VISOR_FUNCTION_CONSOLE to the visor startup function. This was a | ||
241 | patch from Miles Lott (milos@insync.net). | ||
242 | Fixed bug with not restoring the minor range that a device grabs, if | ||
243 | the startup function fails (thanks Miles for finding this). | ||
244 | |||
245 | (02/05/2000) gkh | ||
246 | Added initial framework for the Keyspan PDA serial converter so that | ||
247 | Brian Warner has a place to put his code. | ||
248 | Made the ezusb specific functions generic enough that different | ||
249 | devices can use them (whiteheat and keyspan_pda both need them). | ||
250 | Split out a whole bunch of structure and other stuff to a separate | ||
251 | usb-serial.h file. | ||
252 | Made the Visor connection messages a little more understandable, now | ||
253 | that Miles Lott (milos@insync.net) has gotten the Generic channel to | ||
254 | work. Also made them always show up in the log file. | ||
255 | |||
256 | (01/25/2000) gkh | ||
257 | Added initial framework for FTDI serial converter so that Bill Ryder | ||
258 | has a place to put his code. | ||
259 | Added the vendor specific info from Handspring. Now we can print out | ||
260 | informational debug messages as well as understand what is happening. | ||
261 | |||
262 | (01/23/2000) gkh | ||
263 | Fixed problem of crash when trying to open a port that didn't have a | ||
264 | device assigned to it. Made the minor node finding a little smarter, | ||
265 | now it looks to find a continuous space for the new device. | ||
266 | |||
267 | (01/21/2000) gkh | ||
268 | Fixed bug in visor_startup with patch from Miles Lott (milos@insync.net) | ||
269 | Fixed get_serial_by_minor which was all messed up for multi port | ||
270 | devices. Fixed multi port problem for generic devices. Now the number | ||
271 | of ports is determined by the number of bulk out endpoints for the | ||
272 | generic device. | ||
273 | |||
274 | (01/19/2000) gkh | ||
275 | Removed lots of cruft that was around from the old (pre urb) driver | ||
276 | interface. | ||
277 | Made the serial_table dynamic. This should save lots of memory when | ||
278 | the number of minor nodes goes up to 256. | ||
279 | Added initial support for devices that have more than one port. | ||
280 | Added more debugging comments for the Visor, and added a needed | ||
281 | set_configuration call. | ||
282 | |||
283 | (01/17/2000) gkh | ||
284 | Fixed the WhiteHEAT firmware (my processing tool had a bug) | ||
285 | and added new debug loader firmware for it. | ||
286 | Removed the put_char function as it isn't really needed. | ||
287 | Added visor startup commands as found by the Win98 dump. | ||
288 | |||
289 | (01/13/2000) gkh | ||
290 | Fixed the vendor id for the generic driver to the one I meant it to be. | ||
291 | |||
292 | (01/12/2000) gkh | ||
293 | Forget the version numbering...that's pretty useless... | ||
294 | Made the driver able to be compiled so that the user can select which | ||
295 | converter they want to use. This allows people who only want the Visor | ||
296 | support to not pay the memory size price of the WhiteHEAT. | ||
297 | Fixed bug where the generic driver (idVendor=0000 and idProduct=0000) | ||
298 | grabbed the root hub. Not good. | ||
299 | |||
300 | version 0.4.0 (01/10/2000) gkh | ||
301 | Added whiteheat.h containing the firmware for the ConnectTech WhiteHEAT | ||
302 | device. Added startup function to allow firmware to be downloaded to | ||
303 | a device if it needs to be. | ||
304 | Added firmware download logic to the WhiteHEAT device. | ||
305 | Started to add #defines to split up the different drivers for potential | ||
306 | configuration option. | ||
307 | |||
308 | version 0.3.1 (12/30/99) gkh | ||
309 | Fixed problems with urb for bulk out. | ||
310 | Added initial support for multiple sets of endpoints. This enables | ||
311 | the Handspring Visor to be attached successfully. Only the first | ||
312 | bulk in / bulk out endpoint pair is being used right now. | ||
313 | |||
314 | version 0.3.0 (12/27/99) gkh | ||
315 | Added initial support for the Handspring Visor based on a patch from | ||
316 | Miles Lott (milos@sneety.insync.net) | ||
317 | Cleaned up the code a bunch and converted over to using urbs only. | ||
318 | |||
319 | version 0.2.3 (12/21/99) gkh | ||
320 | Added initial support for the Connect Tech WhiteHEAT converter. | ||
321 | Incremented the number of ports in expectation of getting the | ||
322 | WhiteHEAT to work properly (4 ports per connection). | ||
323 | Added notification on insertion and removal of what port the | ||
324 | device is/was connected to (and what kind of device it was). | ||
325 | |||
326 | version 0.2.2 (12/16/99) gkh | ||
327 | Changed major number to the new allocated number. We're legal now! | ||
328 | |||
329 | version 0.2.1 (12/14/99) gkh | ||
330 | Fixed bug that happens when device node is opened when there isn't a | ||
331 | device attached to it. Thanks to marek@webdesign.no for noticing this. | ||
332 | |||
333 | version 0.2.0 (11/10/99) gkh | ||
334 | Split up internals to make it easier to add different types of serial | ||
335 | converters to the code. | ||
336 | Added a "generic" driver that gets it's vendor and product id | ||
337 | from when the module is loaded. Thanks to David E. Nelson (dnelson@jump.net) | ||
338 | for the idea and sample code (from the usb scanner driver.) | ||
339 | Cleared up any licensing questions by releasing it under the GNU GPL. | ||
340 | |||
341 | version 0.1.2 (10/25/99) gkh | ||
342 | Fixed bug in detecting device. | ||
343 | |||
344 | version 0.1.1 (10/05/99) gkh | ||
345 | Changed the major number to not conflict with anything else. | ||
346 | |||
347 | version 0.1 (09/28/99) gkh | ||
348 | Can recognize the two different devices and start up a read from | ||
349 | device when asked to. Writes also work. No control signals yet, this | ||
350 | all is vendor specific data (i.e. no spec), also no control for | ||
351 | different baud rates or other bit settings. | ||
352 | Currently we are using the same devid as the acm driver. This needs | ||
353 | to change. | ||
354 | |||
355 | ----------------------------------------------------------------------- | ||
356 | visor.c Change Log comments: | ||
357 | |||
358 | (06/03/2003) Judd Montgomery <judd at jpilot.org> | ||
359 | Added support for module parameter options for untested/unknown | ||
360 | devices. | ||
361 | |||
362 | (03/09/2003) gkh | ||
363 | Added support for the Sony Clie NZ90V device. Thanks to Martin Brachtl | ||
364 | <brachtl@redgrep.cz> for the information. | ||
365 | |||
366 | (03/05/2003) gkh | ||
367 | Think Treo support is now working. | ||
368 | |||
369 | (04/03/2002) gkh | ||
370 | Added support for the Sony OS 4.1 devices. Thanks to Hiroyuki ARAKI | ||
371 | <hiro@zob.ne.jp> for the information. | ||
372 | |||
373 | (03/27/2002) gkh | ||
374 | Removed assumptions that port->tty was always valid (is not true | ||
375 | for usb serial console devices.) | ||
376 | |||
377 | (03/23/2002) gkh | ||
378 | Added support for the Palm i705 device, thanks to Thomas Riemer | ||
379 | <tom@netmech.com> for the information. | ||
380 | |||
381 | (03/21/2002) gkh | ||
382 | Added support for the Palm m130 device, thanks to Udo Eisenbarth | ||
383 | <udo.eisenbarth@web.de> for the information. | ||
384 | |||
385 | (02/27/2002) gkh | ||
386 | Reworked the urb handling logic. We have no more pool, but dynamically | ||
387 | allocate the urb and the transfer buffer on the fly. In testing this | ||
388 | does not incure any measurable overhead. This also relies on the fact | ||
389 | that we have proper reference counting logic for urbs. | ||
390 | |||
391 | (02/21/2002) SilaS | ||
392 | Added initial support for the Palm m515 devices. | ||
393 | |||
394 | (02/14/2002) gkh | ||
395 | Added support for the Clie S-360 device. | ||
396 | |||
397 | (12/18/2001) gkh | ||
398 | Added better Clie support for 3.5 devices. Thanks to Geoffrey Levand | ||
399 | for the patch. | ||
400 | |||
401 | (11/11/2001) gkh | ||
402 | Added support for the m125 devices, and added check to prevent oopses | ||
403 | for Clié devices that lie about the number of ports they have. | ||
404 | |||
405 | (08/30/2001) gkh | ||
406 | Added support for the Clie devices, both the 3.5 and 4.0 os versions. | ||
407 | Many thanks to Daniel Burke, and Bryan Payne for helping with this. | ||
408 | |||
409 | (08/23/2001) gkh | ||
410 | fixed a few potential bugs pointed out by Oliver Neukum. | ||
411 | |||
412 | (05/30/2001) gkh | ||
413 | switched from using spinlock to a semaphore, which fixes lots of problems. | ||
414 | |||
415 | (05/28/2000) gkh | ||
416 | Added initial support for the Palm m500 and Palm m505 devices. | ||
417 | |||
418 | (04/08/2001) gb | ||
419 | Identify version on module load. | ||
420 | |||
421 | (01/21/2000) gkh | ||
422 | Added write_room and chars_in_buffer, as they were previously using the | ||
423 | generic driver versions which is all wrong now that we are using an urb | ||
424 | pool. Thanks to Wolfgang Grandegger for pointing this out to me. | ||
425 | Removed count assignment in the write function, which was not needed anymore | ||
426 | either. Thanks to Al Borchers for pointing this out. | ||
427 | |||
428 | (12/12/2000) gkh | ||
429 | Moved MOD_DEC to end of visor_close to be nicer, as the final write | ||
430 | message can sleep. | ||
431 | |||
432 | (11/12/2000) gkh | ||
433 | Fixed bug with data being dropped on the floor by forcing tty->low_latency | ||
434 | to be on. Hopefully this fixes the OHCI issue! | ||
435 | |||
436 | (11/01/2000) Adam J. Richter | ||
437 | usb_device_id table support | ||
438 | |||
439 | (10/05/2000) gkh | ||
440 | Fixed bug with urb->dev not being set properly, now that the usb | ||
441 | core needs it. | ||
442 | |||
443 | (09/11/2000) gkh | ||
444 | Got rid of always calling kmalloc for every urb we wrote out to the | ||
445 | device. | ||
446 | Added visor_read_callback so we can keep track of bytes in and out for | ||
447 | those people who like to know the speed of their device. | ||
448 | Removed DEBUG #ifdefs with call to usb_serial_debug_data | ||
449 | |||
450 | (09/06/2000) gkh | ||
451 | Fixed oops in visor_exit. Need to uncomment usb_unlink_urb call _after_ | ||
452 | the host controller drivers set urb->dev = NULL when the urb is finished. | ||
453 | |||
454 | (08/28/2000) gkh | ||
455 | Added locks for SMP safeness. | ||
456 | |||
457 | (08/08/2000) gkh | ||
458 | Fixed endian problem in visor_startup. | ||
459 | Fixed MOD_INC and MOD_DEC logic and the ability to open a port more | ||
460 | than once. | ||
461 | |||
462 | (07/23/2000) gkh | ||
463 | Added pool of write urbs to speed up transfers to the visor. | ||
464 | |||
465 | (07/19/2000) gkh | ||
466 | Added module_init and module_exit functions to handle the fact that this | ||
467 | driver is a loadable module now. | ||
468 | |||
469 | (07/03/2000) gkh | ||
470 | Added visor_set_ioctl and visor_set_termios functions (they don't do much | ||
471 | of anything, but are good for debugging.) | ||
472 | |||
473 | (06/25/2000) gkh | ||
474 | Fixed bug in visor_unthrottle that should help with the disconnect in PPP | ||
475 | bug that people have been reporting. | ||
476 | |||
477 | (06/23/2000) gkh | ||
478 | Cleaned up debugging statements in a quest to find UHCI timeout bug. | ||
479 | |||
480 | (04/27/2000) Ryan VanderBijl | ||
481 | Fixed memory leak in visor_close | ||
482 | |||
483 | (03/26/2000) gkh | ||
484 | Split driver up into device specific pieces. | ||
485 | |||
486 | ----------------------------------------------------------------------- | ||
487 | pl2303.c Change Log comments: | ||
488 | |||
489 | 2002_Mar_26 gkh | ||
490 | allowed driver to work properly if there is no tty assigned to a port | ||
491 | (this happens for serial console devices.) | ||
492 | |||
493 | 2001_Oct_06 gkh | ||
494 | Added RTS and DTR line control. Thanks to joe@bndlg.de for parts of it. | ||
495 | |||
496 | 2001_Sep_19 gkh | ||
497 | Added break support. | ||
498 | |||
499 | 2001_Aug_30 gkh | ||
500 | fixed oops in write_bulk_callback. | ||
501 | |||
502 | 2001_Aug_28 gkh | ||
503 | reworked buffer logic to be like other usb-serial drivers. Hopefully | ||
504 | removing some reported problems. | ||
505 | |||
506 | 2001_Jun_06 gkh | ||
507 | finished porting to 2.4 format. | ||
508 | |||
509 | |||
510 | ----------------------------------------------------------------------- | ||
511 | io_edgeport.c Change Log comments: | ||
512 | |||
513 | 2003_04_03 al borchers | ||
514 | - fixed a bug (that shows up with dosemu) where the tty struct is | ||
515 | used in a callback after it has been freed | ||
516 | |||
517 | 2.3 2002_03_08 greg kroah-hartman | ||
518 | - fixed bug when multiple devices were attached at the same time. | ||
519 | |||
520 | 2.2 2001_11_14 greg kroah-hartman | ||
521 | - fixed bug in edge_close that kept the port from being used more | ||
522 | than once. | ||
523 | - fixed memory leak on device removal. | ||
524 | - fixed potential double free of memory when command urb submitting | ||
525 | failed. | ||
526 | - other small cleanups when the device is removed | ||
527 | |||
528 | 2.1 2001_07_09 greg kroah-hartman | ||
529 | - added support for TIOCMBIS and TIOCMBIC. | ||
530 | |||
531 | (04/08/2001) gb | ||
532 | - Identify version on module load. | ||
533 | |||
534 | 2.0 2001_03_05 greg kroah-hartman | ||
535 | - reworked entire driver to fit properly in with the other usb-serial | ||
536 | drivers. Occasional oopses still happen, but it's a good start. | ||
537 | |||
538 | 1.2.3 (02/23/2001) greg kroah-hartman | ||
539 | - changed device table to work properly for 2.4.x final format. | ||
540 | - fixed problem with dropping data at high data rates. | ||
541 | |||
542 | 1.2.2 (11/27/2000) greg kroah-hartman | ||
543 | - cleaned up more NTisms. | ||
544 | - Added device table for 2.4.0-test11 | ||
545 | |||
546 | 1.2.1 (11/08/2000) greg kroah-hartman | ||
547 | - Started to clean up NTisms. | ||
548 | - Fixed problem with dev field of urb for kernels >= 2.4.0-test9 | ||
549 | |||
550 | 1.2 (10/17/2000) David Iacovelli | ||
551 | Remove all EPIC code and GPL source | ||
552 | Fix RELEVANT_IFLAG macro to include flow control | ||
553 | changes port configuration changes. | ||
554 | Fix redefinition of SERIAL_MAGIC | ||
555 | Change all timeout values to 5 seconds | ||
556 | Tried to fix the UHCI multiple urb submission, but failed miserably. | ||
557 | it seems to work fine with OHCI. | ||
558 | ( Greg take a look at the #if 0 at end of WriteCmdUsb() we must | ||
559 | find a way to work arount this UHCI bug ) | ||
560 | |||
561 | 1.1 (10/11/2000) David Iacovelli | ||
562 | Fix XON/XOFF flow control to support both IXON and IXOFF | ||
563 | |||
564 | 0.9.27 (06/30/2000) David Iacovelli | ||
565 | Added transmit queue and now allocate urb for command writes. | ||
566 | |||
567 | 0.9.26 (06/29/2000) David Iacovelli | ||
568 | Add support for 80251 based edgeport | ||
569 | |||
570 | 0.9.25 (06/27/2000) David Iacovelli | ||
571 | Do not close the port if it has multiple opens. | ||
572 | |||
573 | 0.9.24 (05/26/2000) David Iacovelli | ||
574 | Add IOCTLs to support RXTX and JAVA POS | ||
575 | and first cut at running BlackBox Demo | ||
576 | |||
577 | 0.9.23 (05/24/2000) David Iacovelli | ||
578 | Add IOCTLs to support RXTX and JAVA POS | ||
579 | |||
580 | 0.9.22 (05/23/2000) David Iacovelli | ||
581 | fixed bug in enumeration. If epconfig turns on mapping by | ||
582 | path after a device is already plugged in, we now update | ||
583 | the mapping correctly | ||
584 | |||
585 | 0.9.21 (05/16/2000) David Iacovelli | ||
586 | Added BlockUntilChaseResp() to also wait for txcredits | ||
587 | Updated the way we allocate and handle write URBs | ||
588 | Add debug code to dump buffers | ||
589 | |||
590 | 0.9.20 (05/01/2000) David Iacovelli | ||
591 | change driver to use usb/tts/ | ||
592 | |||
593 | 0.9.19 (05/01/2000) David Iacovelli | ||
594 | Update code to compile if DEBUG is off | ||
595 | |||
596 | 0.9.18 (04/28/2000) David Iacovelli | ||
597 | cleanup and test tty_register with devfs | ||
598 | |||
599 | 0.9.17 (04/27/2000) greg kroah-hartman | ||
600 | changed tty_register around to be like the way it | ||
601 | was before, but now it works properly with devfs. | ||
602 | |||
603 | 0.9.16 (04/26/2000) david iacovelli | ||
604 | Fixed bug in GetProductInfo() | ||
605 | |||
606 | 0.9.15 (04/25/2000) david iacovelli | ||
607 | Updated enumeration | ||
608 | |||
609 | 0.9.14 (04/24/2000) david iacovelli | ||
610 | Removed all config/status IOCTLS and | ||
611 | converted to using /proc/edgeport | ||
612 | still playing with devfs | ||
613 | |||
614 | 0.9.13 (04/24/2000) david iacovelli | ||
615 | Removed configuration based on ttyUSB0 | ||
616 | Added support for configuration using /prod/edgeport | ||
617 | first attempt at using devfs (not working yet!) | ||
618 | Added IOCTL to GetProductInfo() | ||
619 | Added support for custom baud rates | ||
620 | Add support for random port numbers | ||
621 | |||
622 | 0.9.12 (04/18/2000) david iacovelli | ||
623 | added additional configuration IOCTLs | ||
624 | use ttyUSB0 for configuration | ||
625 | |||
626 | 0.9.11 (04/17/2000) greg kroah-hartman | ||
627 | fixed module initialization race conditions. | ||
628 | made all urbs dynamically allocated. | ||
629 | made driver devfs compatible. now it only registers the tty device | ||
630 | when the device is actually plugged in. | ||
631 | |||
632 | 0.9.10 (04/13/2000) greg kroah-hartman | ||
633 | added proc interface framework. | ||
634 | |||
635 | 0.9.9 (04/13/2000) david iacovelli | ||
636 | added enumeration code and ioctls to configure the device | ||
637 | |||
638 | 0.9.8 (04/12/2000) david iacovelli | ||
639 | Change interrupt read start when device is plugged in | ||
640 | and stop when device is removed | ||
641 | process interrupt reads when all ports are closed | ||
642 | (keep value of rxBytesAvail consistent with the edgeport) | ||
643 | set the USB_BULK_QUEUE flag so that we can shove a bunch | ||
644 | of urbs at once down the pipe | ||
645 | |||
646 | 0.9.7 (04/10/2000) david iacovelli | ||
647 | start to add enumeration code. | ||
648 | generate serial number for epic devices | ||
649 | add support for kdb | ||
650 | |||
651 | 0.9.6 (03/30/2000) david iacovelli | ||
652 | add IOCTL to get string, manufacture, and boot descriptors | ||
653 | |||
654 | 0.9.5 (03/14/2000) greg kroah-hartman | ||
655 | more error checking added to SerialOpen to try to fix UHCI open problem | ||
656 | |||
657 | 0.9.4 (03/09/2000) greg kroah-hartman | ||
658 | added more error checking to handle oops when data is hanging | ||
659 | around and tty is abruptly closed. | ||
660 | |||
661 | 0.9.3 (03/09/2000) david iacovelli | ||
662 | Add epic support for xon/xoff chars | ||
663 | play with performance | ||
664 | |||
665 | 0.9.2 (03/08/2000) greg kroah-hartman | ||
666 | changed most "info" calls to "dbg" | ||
667 | implemented flow control properly in the termios call | ||
668 | |||
669 | 0.9.1 (03/08/2000) david iacovelli | ||
670 | added EPIC support | ||
671 | enabled bootloader update | ||
672 | |||
673 | 0.9 (03/08/2000) greg kroah-hartman | ||
674 | Release to IO networks. | ||
675 | Integrated changes that David made | ||
676 | made getting urbs for writing SMP safe | ||
677 | |||
678 | 0.8 (03/07/2000) greg kroah-hartman | ||
679 | Release to IO networks. | ||
680 | Fixed problems that were seen in code by David. | ||
681 | Now both Edgeport/4 and Edgeport/2 works properly. | ||
682 | Changed most of the functions to use port instead of serial. | ||
683 | |||
684 | 0.7 (02/27/2000) greg kroah-hartman | ||
685 | Milestone 3 release. | ||
686 | Release to IO Networks | ||
687 | ioctl for waiting on line change implemented. | ||
688 | ioctl for getting statistics implemented. | ||
689 | multiport support working. | ||
690 | lsr and msr registers are now handled properly. | ||
691 | change break now hooked up and working. | ||
692 | support for all known Edgeport devices. | ||
693 | |||
694 | 0.6 (02/22/2000) greg kroah-hartman | ||
695 | Release to IO networks. | ||
696 | CHASE is implemented correctly when port is closed. | ||
697 | SerialOpen now blocks correctly until port is fully opened. | ||
698 | |||
699 | 0.5 (02/20/2000) greg kroah-hartman | ||
700 | Release to IO networks. | ||
701 | Known problems: | ||
702 | modem status register changes are not sent on to the user | ||
703 | CHASE is not implemented when the port is closed. | ||
704 | |||
705 | 0.4 (02/16/2000) greg kroah-hartman | ||
706 | Second cut at the CeBit demo. | ||
707 | Doesn't leak memory on every write to the port | ||
708 | Still small leaks on startup. | ||
709 | Added support for Edgeport/2 and Edgeport/8 | ||
710 | |||
711 | 0.3 (02/15/2000) greg kroah-hartman | ||
712 | CeBit demo release. | ||
713 | Force the line settings to 4800, 8, 1, e for the demo. | ||
714 | Warning! This version leaks memory like crazy! | ||
715 | |||
716 | 0.2 (01/30/2000) greg kroah-hartman | ||
717 | Milestone 1 release. | ||
718 | Device is found by USB subsystem, enumerated, firmware is downloaded | ||
719 | and the descriptors are printed to the debug log, config is set, and | ||
720 | green light starts to blink. Open port works, and data can be sent | ||
721 | and received at the default settings of the UART. Loopback connector | ||
722 | and debug log confirms this. | ||
723 | |||
724 | 0.1 (01/23/2000) greg kroah-hartman | ||
725 | Initial release to help IO Networks try to set up their test system. | ||
726 | Edgeport4 is recognized, firmware is downloaded, config is set so | ||
727 | device blinks green light every 3 sec. Port is bound, but opening, | ||
728 | closing, and sending data do not work properly. | ||
729 | |||
730 | |||
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index d6921fa1403c..f9f29b289f2f 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c | |||
@@ -20,50 +20,7 @@ | |||
20 | * TODO: | 20 | * TODO: |
21 | * -- Add true modem contol line query capability. Currently we track the | 21 | * -- Add true modem contol line query capability. Currently we track the |
22 | * states reported by the interrupt and the states we request. | 22 | * states reported by the interrupt and the states we request. |
23 | * -- Add error reporting back to application for UART error conditions. | ||
24 | * Just point me at how to implement this and I'll do it. I've put the | ||
25 | * framework in, but haven't analyzed the "tty_flip" interface yet. | ||
26 | * -- Add support for flush commands | 23 | * -- Add support for flush commands |
27 | * -- Add everything that is missing :) | ||
28 | * | ||
29 | * 27-Nov-2001 gkh | ||
30 | * compressed all the differnent device entries into 1. | ||
31 | * | ||
32 | * 30-May-2001 gkh | ||
33 | * switched from using spinlock to a semaphore, which fixes lots of | ||
34 | * problems. | ||
35 | * | ||
36 | * 08-Apr-2001 gb | ||
37 | * - Identify version on module load. | ||
38 | * | ||
39 | * 12-Mar-2001 gkh | ||
40 | * - Added support for the GoHubs GO-COM232 device which is the same as the | ||
41 | * Peracom device. | ||
42 | * | ||
43 | * 06-Nov-2000 gkh | ||
44 | * - Added support for the old Belkin and Peracom devices. | ||
45 | * - Made the port able to be opened multiple times. | ||
46 | * - Added some defaults incase the line settings are things these devices | ||
47 | * can't support. | ||
48 | * | ||
49 | * 18-Oct-2000 William Greathouse | ||
50 | * Released into the wild (linux-usb-devel) | ||
51 | * | ||
52 | * 17-Oct-2000 William Greathouse | ||
53 | * Add code to recognize firmware version and set hardware flow control | ||
54 | * appropriately. Belkin states that firmware prior to 3.05 does not | ||
55 | * operate correctly in hardware handshake mode. I have verified this | ||
56 | * on firmware 2.05 -- for both RTS and DTR input flow control, the control | ||
57 | * line is not reset. The test performed by the Belkin Win* driver is | ||
58 | * to enable hardware flow control for firmware 2.06 or greater and | ||
59 | * for 1.00 or prior. I am only enabling for 2.06 or greater. | ||
60 | * | ||
61 | * 12-Oct-2000 William Greathouse | ||
62 | * First cut at supporting Belkin USB Serial Adapter F5U103 | ||
63 | * I did not have a copy of the original work to support this | ||
64 | * adapter, so pardon any stupid mistakes. All of the information | ||
65 | * I am using to write this driver was acquired by using a modified | ||
66 | * UsbSnoop on Windows2000 and from examining the other USB drivers. | ||
67 | */ | 24 | */ |
68 | 25 | ||
69 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 6ae1c0688b5e..0e77511060c0 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -335,13 +335,12 @@ static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
335 | goto out; | 335 | goto out; |
336 | 336 | ||
337 | dbg("%s - submitting interrupt urb", __func__); | 337 | dbg("%s - submitting interrupt urb", __func__); |
338 | port->interrupt_in_urb->dev = serial->dev; | ||
339 | r = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 338 | r = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
340 | if (r) { | 339 | if (r) { |
341 | dev_err(&port->dev, "%s - failed submitting interrupt urb," | 340 | dev_err(&port->dev, "%s - failed submitting interrupt urb," |
342 | " error %d\n", __func__, r); | 341 | " error %d\n", __func__, r); |
343 | ch341_close(port); | 342 | ch341_close(port); |
344 | return -EPROTO; | 343 | goto out; |
345 | } | 344 | } |
346 | 345 | ||
347 | r = usb_serial_generic_open(tty, port); | 346 | r = usb_serial_generic_open(tty, port); |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index fd67cc53545b..7175bb107dec 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -280,7 +280,10 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request, | |||
280 | dbg("%s - Unable to send config request, " | 280 | dbg("%s - Unable to send config request, " |
281 | "request=0x%x size=%d result=%d\n", | 281 | "request=0x%x size=%d result=%d\n", |
282 | __func__, request, size, result); | 282 | __func__, request, size, result); |
283 | return -EPROTO; | 283 | if (result > 0) |
284 | result = -EPROTO; | ||
285 | |||
286 | return result; | ||
284 | } | 287 | } |
285 | 288 | ||
286 | return 0; | 289 | return 0; |
@@ -331,7 +334,10 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request, | |||
331 | dbg("%s - Unable to send request, " | 334 | dbg("%s - Unable to send request, " |
332 | "request=0x%x size=%d result=%d\n", | 335 | "request=0x%x size=%d result=%d\n", |
333 | __func__, request, size, result); | 336 | __func__, request, size, result); |
334 | return -EPROTO; | 337 | if (result > 0) |
338 | result = -EPROTO; | ||
339 | |||
340 | return result; | ||
335 | } | 341 | } |
336 | 342 | ||
337 | return 0; | 343 | return 0; |
@@ -395,10 +401,11 @@ static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
395 | 401 | ||
396 | dbg("%s - port %d", __func__, port->number); | 402 | dbg("%s - port %d", __func__, port->number); |
397 | 403 | ||
398 | if (cp210x_set_config_single(port, CP210X_IFC_ENABLE, UART_ENABLE)) { | 404 | result = cp210x_set_config_single(port, CP210X_IFC_ENABLE, |
399 | dev_err(&port->dev, "%s - Unable to enable UART\n", | 405 | UART_ENABLE); |
400 | __func__); | 406 | if (result) { |
401 | return -EPROTO; | 407 | dev_err(&port->dev, "%s - Unable to enable UART\n", __func__); |
408 | return result; | ||
402 | } | 409 | } |
403 | 410 | ||
404 | result = usb_serial_generic_open(tty, port); | 411 | result = usb_serial_generic_open(tty, port); |
@@ -520,18 +527,13 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, | |||
520 | cflag |= PARENB; | 527 | cflag |= PARENB; |
521 | break; | 528 | break; |
522 | case BITS_PARITY_MARK: | 529 | case BITS_PARITY_MARK: |
523 | dbg("%s - parity = MARK (not supported, disabling parity)", | 530 | dbg("%s - parity = MARK", __func__); |
524 | __func__); | 531 | cflag |= (PARENB|PARODD|CMSPAR); |
525 | cflag &= ~PARENB; | ||
526 | bits &= ~BITS_PARITY_MASK; | ||
527 | cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); | ||
528 | break; | 532 | break; |
529 | case BITS_PARITY_SPACE: | 533 | case BITS_PARITY_SPACE: |
530 | dbg("%s - parity = SPACE (not supported, disabling parity)", | 534 | dbg("%s - parity = SPACE", __func__); |
531 | __func__); | 535 | cflag &= ~PARODD; |
532 | cflag &= ~PARENB; | 536 | cflag |= (PARENB|CMSPAR); |
533 | bits &= ~BITS_PARITY_MASK; | ||
534 | cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); | ||
535 | break; | 537 | break; |
536 | default: | 538 | default: |
537 | dbg("%s - Unknown parity mode, disabling parity", __func__); | 539 | dbg("%s - Unknown parity mode, disabling parity", __func__); |
@@ -588,7 +590,6 @@ static void cp210x_set_termios(struct tty_struct *tty, | |||
588 | if (!tty) | 590 | if (!tty) |
589 | return; | 591 | return; |
590 | 592 | ||
591 | tty->termios->c_cflag &= ~CMSPAR; | ||
592 | cflag = tty->termios->c_cflag; | 593 | cflag = tty->termios->c_cflag; |
593 | old_cflag = old_termios->c_cflag; | 594 | old_cflag = old_termios->c_cflag; |
594 | baud = cp210x_quantise_baudrate(tty_get_baud_rate(tty)); | 595 | baud = cp210x_quantise_baudrate(tty_get_baud_rate(tty)); |
@@ -643,16 +644,27 @@ static void cp210x_set_termios(struct tty_struct *tty, | |||
643 | "not supported by device\n"); | 644 | "not supported by device\n"); |
644 | } | 645 | } |
645 | 646 | ||
646 | if ((cflag & (PARENB|PARODD)) != (old_cflag & (PARENB|PARODD))) { | 647 | if ((cflag & (PARENB|PARODD|CMSPAR)) != |
648 | (old_cflag & (PARENB|PARODD|CMSPAR))) { | ||
647 | cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2); | 649 | cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2); |
648 | bits &= ~BITS_PARITY_MASK; | 650 | bits &= ~BITS_PARITY_MASK; |
649 | if (cflag & PARENB) { | 651 | if (cflag & PARENB) { |
650 | if (cflag & PARODD) { | 652 | if (cflag & CMSPAR) { |
651 | bits |= BITS_PARITY_ODD; | 653 | if (cflag & PARODD) { |
652 | dbg("%s - parity = ODD", __func__); | 654 | bits |= BITS_PARITY_MARK; |
655 | dbg("%s - parity = MARK", __func__); | ||
656 | } else { | ||
657 | bits |= BITS_PARITY_SPACE; | ||
658 | dbg("%s - parity = SPACE", __func__); | ||
659 | } | ||
653 | } else { | 660 | } else { |
654 | bits |= BITS_PARITY_EVEN; | 661 | if (cflag & PARODD) { |
655 | dbg("%s - parity = EVEN", __func__); | 662 | bits |= BITS_PARITY_ODD; |
663 | dbg("%s - parity = ODD", __func__); | ||
664 | } else { | ||
665 | bits |= BITS_PARITY_EVEN; | ||
666 | dbg("%s - parity = EVEN", __func__); | ||
667 | } | ||
656 | } | 668 | } |
657 | } | 669 | } |
658 | if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) | 670 | if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) |
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index f744ab7a3b19..98bf83349838 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c | |||
@@ -138,7 +138,6 @@ static int cyberjack_startup(struct usb_serial *serial) | |||
138 | 138 | ||
139 | for (i = 0; i < serial->num_ports; ++i) { | 139 | for (i = 0; i < serial->num_ports; ++i) { |
140 | int result; | 140 | int result; |
141 | serial->port[i]->interrupt_in_urb->dev = serial->dev; | ||
142 | result = usb_submit_urb(serial->port[i]->interrupt_in_urb, | 141 | result = usb_submit_urb(serial->port[i]->interrupt_in_urb, |
143 | GFP_KERNEL); | 142 | GFP_KERNEL); |
144 | if (result) | 143 | if (result) |
@@ -208,7 +207,6 @@ static void cyberjack_close(struct usb_serial_port *port) | |||
208 | static int cyberjack_write(struct tty_struct *tty, | 207 | static int cyberjack_write(struct tty_struct *tty, |
209 | struct usb_serial_port *port, const unsigned char *buf, int count) | 208 | struct usb_serial_port *port, const unsigned char *buf, int count) |
210 | { | 209 | { |
211 | struct usb_serial *serial = port->serial; | ||
212 | struct cyberjack_private *priv = usb_get_serial_port_data(port); | 210 | struct cyberjack_private *priv = usb_get_serial_port_data(port); |
213 | unsigned long flags; | 211 | unsigned long flags; |
214 | int result; | 212 | int result; |
@@ -221,22 +219,18 @@ static int cyberjack_write(struct tty_struct *tty, | |||
221 | return 0; | 219 | return 0; |
222 | } | 220 | } |
223 | 221 | ||
224 | spin_lock_bh(&port->lock); | 222 | if (!test_and_clear_bit(0, &port->write_urbs_free)) { |
225 | if (port->write_urb_busy) { | ||
226 | spin_unlock_bh(&port->lock); | ||
227 | dbg("%s - already writing", __func__); | 223 | dbg("%s - already writing", __func__); |
228 | return 0; | 224 | return 0; |
229 | } | 225 | } |
230 | port->write_urb_busy = 1; | ||
231 | spin_unlock_bh(&port->lock); | ||
232 | 226 | ||
233 | spin_lock_irqsave(&priv->lock, flags); | 227 | spin_lock_irqsave(&priv->lock, flags); |
234 | 228 | ||
235 | if (count+priv->wrfilled > sizeof(priv->wrbuf)) { | 229 | if (count+priv->wrfilled > sizeof(priv->wrbuf)) { |
236 | /* To much data for buffer. Reset buffer. */ | 230 | /* To much data for buffer. Reset buffer. */ |
237 | priv->wrfilled = 0; | 231 | priv->wrfilled = 0; |
238 | port->write_urb_busy = 0; | ||
239 | spin_unlock_irqrestore(&priv->lock, flags); | 232 | spin_unlock_irqrestore(&priv->lock, flags); |
233 | set_bit(0, &port->write_urbs_free); | ||
240 | return 0; | 234 | return 0; |
241 | } | 235 | } |
242 | 236 | ||
@@ -265,13 +259,7 @@ static int cyberjack_write(struct tty_struct *tty, | |||
265 | priv->wrsent = length; | 259 | priv->wrsent = length; |
266 | 260 | ||
267 | /* set up our urb */ | 261 | /* set up our urb */ |
268 | usb_fill_bulk_urb(port->write_urb, serial->dev, | 262 | port->write_urb->transfer_buffer_length = length; |
269 | usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress), | ||
270 | port->write_urb->transfer_buffer, length, | ||
271 | ((serial->type->write_bulk_callback) ? | ||
272 | serial->type->write_bulk_callback : | ||
273 | cyberjack_write_bulk_callback), | ||
274 | port); | ||
275 | 263 | ||
276 | /* send the data out the bulk port */ | 264 | /* send the data out the bulk port */ |
277 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 265 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
@@ -283,7 +271,7 @@ static int cyberjack_write(struct tty_struct *tty, | |||
283 | priv->wrfilled = 0; | 271 | priv->wrfilled = 0; |
284 | priv->wrsent = 0; | 272 | priv->wrsent = 0; |
285 | spin_unlock_irqrestore(&priv->lock, flags); | 273 | spin_unlock_irqrestore(&priv->lock, flags); |
286 | port->write_urb_busy = 0; | 274 | set_bit(0, &port->write_urbs_free); |
287 | return 0; | 275 | return 0; |
288 | } | 276 | } |
289 | 277 | ||
@@ -351,7 +339,6 @@ static void cyberjack_read_int_callback(struct urb *urb) | |||
351 | spin_unlock(&priv->lock); | 339 | spin_unlock(&priv->lock); |
352 | 340 | ||
353 | if (!old_rdtodo) { | 341 | if (!old_rdtodo) { |
354 | port->read_urb->dev = port->serial->dev; | ||
355 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 342 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
356 | if (result) | 343 | if (result) |
357 | dev_err(&port->dev, "%s - failed resubmitting " | 344 | dev_err(&port->dev, "%s - failed resubmitting " |
@@ -362,7 +349,6 @@ static void cyberjack_read_int_callback(struct urb *urb) | |||
362 | } | 349 | } |
363 | 350 | ||
364 | resubmit: | 351 | resubmit: |
365 | port->interrupt_in_urb->dev = port->serial->dev; | ||
366 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); | 352 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); |
367 | if (result) | 353 | if (result) |
368 | dev_err(&port->dev, "usb_submit_urb(read int) failed\n"); | 354 | dev_err(&port->dev, "usb_submit_urb(read int) failed\n"); |
@@ -415,7 +401,6 @@ static void cyberjack_read_bulk_callback(struct urb *urb) | |||
415 | 401 | ||
416 | /* Continue to read if we have still urbs to do. */ | 402 | /* Continue to read if we have still urbs to do. */ |
417 | if (todo /* || (urb->actual_length==port->bulk_in_endpointAddress)*/) { | 403 | if (todo /* || (urb->actual_length==port->bulk_in_endpointAddress)*/) { |
418 | port->read_urb->dev = port->serial->dev; | ||
419 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 404 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
420 | if (result) | 405 | if (result) |
421 | dev_err(&port->dev, "%s - failed resubmitting read " | 406 | dev_err(&port->dev, "%s - failed resubmitting read " |
@@ -432,7 +417,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb) | |||
432 | 417 | ||
433 | dbg("%s - port %d", __func__, port->number); | 418 | dbg("%s - port %d", __func__, port->number); |
434 | 419 | ||
435 | port->write_urb_busy = 0; | 420 | set_bit(0, &port->write_urbs_free); |
436 | if (status) { | 421 | if (status) { |
437 | dbg("%s - nonzero write bulk status received: %d", | 422 | dbg("%s - nonzero write bulk status received: %d", |
438 | __func__, status); | 423 | __func__, status); |
@@ -455,13 +440,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb) | |||
455 | priv->wrsent += length; | 440 | priv->wrsent += length; |
456 | 441 | ||
457 | /* set up our urb */ | 442 | /* set up our urb */ |
458 | usb_fill_bulk_urb(port->write_urb, port->serial->dev, | 443 | port->write_urb->transfer_buffer_length = length; |
459 | usb_sndbulkpipe(port->serial->dev, port->bulk_out_endpointAddress), | ||
460 | port->write_urb->transfer_buffer, length, | ||
461 | ((port->serial->type->write_bulk_callback) ? | ||
462 | port->serial->type->write_bulk_callback : | ||
463 | cyberjack_write_bulk_callback), | ||
464 | port); | ||
465 | 444 | ||
466 | /* send the data out the bulk port */ | 445 | /* send the data out the bulk port */ |
467 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 446 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index d9906eb9d16a..07680d6b792b 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -16,32 +16,6 @@ | |||
16 | * | 16 | * |
17 | * See http://geocities.com/i0xox0i for information on this driver and the | 17 | * See http://geocities.com/i0xox0i for information on this driver and the |
18 | * earthmate usb device. | 18 | * earthmate usb device. |
19 | * | ||
20 | * Lonnie Mendez <dignome@gmail.com> | ||
21 | * 4-29-2005 | ||
22 | * Fixed problem where setting or retreiving the serial config would fail | ||
23 | * with EPIPE. Removed CRTS toggling so the driver behaves more like | ||
24 | * other usbserial adapters. Issued new interval of 1ms instead of the | ||
25 | * default 10ms. As a result, transfer speed has been substantially | ||
26 | * increased from avg. 850bps to avg. 3300bps. initial termios has also | ||
27 | * been modified. Cleaned up code and formatting issues so it is more | ||
28 | * readable. Replaced the C++ style comments. | ||
29 | * | ||
30 | * Lonnie Mendez <dignome@gmail.com> | ||
31 | * 12-15-2004 | ||
32 | * Incorporated write buffering from pl2303 driver. Fixed bug with line | ||
33 | * handling so both lines are raised in cypress_open. (was dropping rts) | ||
34 | * Various code cleanups made as well along with other misc bug fixes. | ||
35 | * | ||
36 | * Lonnie Mendez <dignome@gmail.com> | ||
37 | * 04-10-2004 | ||
38 | * Driver modified to support dynamic line settings. Various improvements | ||
39 | * and features. | ||
40 | * | ||
41 | * Neil Whelchel | ||
42 | * 10-2003 | ||
43 | * Driver first released. | ||
44 | * | ||
45 | */ | 19 | */ |
46 | 20 | ||
47 | /* Thanks to Neil Whelchel for writing the first cypress m8 implementation | 21 | /* Thanks to Neil Whelchel for writing the first cypress m8 implementation |
@@ -1162,8 +1136,6 @@ static void cypress_unthrottle(struct tty_struct *tty) | |||
1162 | return; | 1136 | return; |
1163 | 1137 | ||
1164 | if (actually_throttled) { | 1138 | if (actually_throttled) { |
1165 | port->interrupt_in_urb->dev = port->serial->dev; | ||
1166 | |||
1167 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 1139 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
1168 | if (result) { | 1140 | if (result) { |
1169 | dev_err(&port->dev, "%s - failed submitting read urb, " | 1141 | dev_err(&port->dev, "%s - failed submitting read urb, " |
@@ -1352,7 +1324,6 @@ static void cypress_write_int_callback(struct urb *urb) | |||
1352 | dbg("%s - nonzero write bulk status received: %d", | 1324 | dbg("%s - nonzero write bulk status received: %d", |
1353 | __func__, status); | 1325 | __func__, status); |
1354 | port->interrupt_out_urb->transfer_buffer_length = 1; | 1326 | port->interrupt_out_urb->transfer_buffer_length = 1; |
1355 | port->interrupt_out_urb->dev = port->serial->dev; | ||
1356 | result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC); | 1327 | result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC); |
1357 | if (!result) | 1328 | if (!result) |
1358 | return; | 1329 | return; |
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index e92cbefc0f88..6d26a77d0f2a 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -13,222 +13,6 @@ | |||
13 | * | 13 | * |
14 | * Peter Berger (pberger@brimson.com) | 14 | * Peter Berger (pberger@brimson.com) |
15 | * Al Borchers (borchers@steinerpoint.com) | 15 | * Al Borchers (borchers@steinerpoint.com) |
16 | * | ||
17 | * (12/03/2001) gkh | ||
18 | * switched to using port->port.count instead of private version. | ||
19 | * Removed port->active | ||
20 | * | ||
21 | * (04/08/2001) gb | ||
22 | * Identify version on module load. | ||
23 | * | ||
24 | * (11/01/2000) Adam J. Richter | ||
25 | * usb_device_id table support | ||
26 | * | ||
27 | * (11/01/2000) pberger and borchers | ||
28 | * -- Turned off the USB_DISABLE_SPD flag for write bulk urbs--it caused | ||
29 | * USB 4 ports to hang on startup. | ||
30 | * -- Serialized access to write urbs by adding the dp_write_urb_in_use | ||
31 | * flag; otherwise, the driver caused SMP system hangs. Watching the | ||
32 | * urb status is not sufficient. | ||
33 | * | ||
34 | * (10/05/2000) gkh | ||
35 | * -- Fixed bug with urb->dev not being set properly, now that the usb | ||
36 | * core needs it. | ||
37 | * | ||
38 | * (8/8/2000) pberger and borchers | ||
39 | * -- Fixed close so that | ||
40 | * - it can timeout while waiting for transmit idle, if needed; | ||
41 | * - it ignores interrupts when flushing the port, turning | ||
42 | * of modem signalling, and so on; | ||
43 | * - it waits for the flush to really complete before returning. | ||
44 | * -- Read_bulk_callback and write_bulk_callback check for a closed | ||
45 | * port before using the tty struct or writing to the port. | ||
46 | * -- The two changes above fix the oops caused by interrupted closes. | ||
47 | * -- Added interruptible args to write_oob_command and set_modem_signals | ||
48 | * and added a timeout arg to transmit_idle; needed for fixes to | ||
49 | * close. | ||
50 | * -- Added code for rx_throttle and rx_unthrottle so that input flow | ||
51 | * control works. | ||
52 | * -- Added code to set overrun, parity, framing, and break errors | ||
53 | * (untested). | ||
54 | * -- Set USB_DISABLE_SPD flag for write bulk urbs, so no 0 length | ||
55 | * bulk writes are done. These hung the Digi USB device. The | ||
56 | * 0 length bulk writes were a new feature of usb-uhci added in | ||
57 | * the 2.4.0-test6 kernels. | ||
58 | * -- Fixed mod inc race in open; do mod inc before sleeping to wait | ||
59 | * for a close to finish. | ||
60 | * | ||
61 | * (7/31/2000) pberger | ||
62 | * -- Fixed bugs with hardware handshaking: | ||
63 | * - Added code to set/clear tty->hw_stopped in digi_read_oob_callback() | ||
64 | * and digi_set_termios() | ||
65 | * -- Added code in digi_set_termios() to | ||
66 | * - add conditional in code handling transition from B0 to only | ||
67 | * set RTS if RTS/CTS flow control is either not in use or if | ||
68 | * the port is not currently throttled. | ||
69 | * - handle turning off CRTSCTS. | ||
70 | * | ||
71 | * (7/30/2000) borchers | ||
72 | * -- Added support for more than one Digi USB device by moving | ||
73 | * globals to a private structure in the pointed to from the | ||
74 | * usb_serial structure. | ||
75 | * -- Moved the modem change and transmit idle wait queues into | ||
76 | * the port private structure, so each port has its own queue | ||
77 | * rather than sharing global queues. | ||
78 | * -- Added support for break signals. | ||
79 | * | ||
80 | * (7/25/2000) pberger | ||
81 | * -- Added USB-2 support. Note: the USB-2 supports 3 devices: two | ||
82 | * serial and a parallel port. The parallel port is implemented | ||
83 | * as a serial-to-parallel converter. That is, the driver actually | ||
84 | * presents all three USB-2 interfaces as serial ports, but the third | ||
85 | * one physically connects to a parallel device. Thus, for example, | ||
86 | * one could plug a parallel printer into the USB-2's third port, | ||
87 | * but from the kernel's (and userland's) point of view what's | ||
88 | * actually out there is a serial device. | ||
89 | * | ||
90 | * (7/15/2000) borchers | ||
91 | * -- Fixed race in open when a close is in progress. | ||
92 | * -- Keep count of opens and dec the module use count for each | ||
93 | * outstanding open when shutdown is called (on disconnect). | ||
94 | * -- Fixed sanity checks in read_bulk_callback and write_bulk_callback | ||
95 | * so pointers are checked before use. | ||
96 | * -- Split read bulk callback into in band and out of band | ||
97 | * callbacks, and no longer restart read chains if there is | ||
98 | * a status error or a sanity error. This fixed the seg | ||
99 | * faults and other errors we used to get on disconnect. | ||
100 | * -- Port->active is once again a flag as usb-serial intended it | ||
101 | * to be, not a count. Since it was only a char it would | ||
102 | * have been limited to 256 simultaneous opens. Now the open | ||
103 | * count is kept in the port private structure in dp_open_count. | ||
104 | * -- Added code for modularization of the digi_acceleport driver. | ||
105 | * | ||
106 | * (6/27/2000) pberger and borchers | ||
107 | * -- Zeroed out sync field in the wakeup_task before first use; | ||
108 | * otherwise the uninitialized value might prevent the task from | ||
109 | * being scheduled. | ||
110 | * -- Initialized ret value to 0 in write_bulk_callback, otherwise | ||
111 | * the uninitialized value could cause a spurious debugging message. | ||
112 | * | ||
113 | * (6/22/2000) pberger and borchers | ||
114 | * -- Made cond_wait_... inline--apparently on SPARC the flags arg | ||
115 | * to spin_lock_irqsave cannot be passed to another function | ||
116 | * to call spin_unlock_irqrestore. Thanks to Pauline Middelink. | ||
117 | * -- In digi_set_modem_signals the inner nested spin locks use just | ||
118 | * spin_lock() rather than spin_lock_irqsave(). The old code | ||
119 | * mistakenly left interrupts off. Thanks to Pauline Middelink. | ||
120 | * -- copy_from_user (which can sleep) is no longer called while a | ||
121 | * spinlock is held. We copy to a local buffer before getting | ||
122 | * the spinlock--don't like the extra copy but the code is simpler. | ||
123 | * -- Printk and dbg are no longer called while a spin lock is held. | ||
124 | * | ||
125 | * (6/4/2000) pberger and borchers | ||
126 | * -- Replaced separate calls to spin_unlock_irqrestore and | ||
127 | * interruptible_sleep_on_timeout with a new function | ||
128 | * cond_wait_interruptible_timeout_irqrestore. This eliminates | ||
129 | * the race condition where the wake up could happen after | ||
130 | * the unlock and before the sleep. | ||
131 | * -- Close now waits for output to drain. | ||
132 | * -- Open waits until any close in progress is finished. | ||
133 | * -- All out of band responses are now processed, not just the | ||
134 | * first in a USB packet. | ||
135 | * -- Fixed a bug that prevented the driver from working when the | ||
136 | * first Digi port was not the first USB serial port--the driver | ||
137 | * was mistakenly using the external USB serial port number to | ||
138 | * try to index into its internal ports. | ||
139 | * -- Fixed an SMP bug -- write_bulk_callback is called directly from | ||
140 | * an interrupt, so spin_lock_irqsave/spin_unlock_irqrestore are | ||
141 | * needed for locks outside write_bulk_callback that are also | ||
142 | * acquired by write_bulk_callback to prevent deadlocks. | ||
143 | * -- Fixed support for select() by making digi_chars_in_buffer() | ||
144 | * return 256 when -EINPROGRESS is set, as the line discipline | ||
145 | * code in n_tty.c expects. | ||
146 | * -- Fixed an include file ordering problem that prevented debugging | ||
147 | * messages from working. | ||
148 | * -- Fixed an intermittent timeout problem that caused writes to | ||
149 | * sometimes get stuck on some machines on some kernels. It turns | ||
150 | * out in these circumstances write_chan() (in n_tty.c) was | ||
151 | * asleep waiting for our wakeup call. Even though we call | ||
152 | * wake_up_interruptible() in digi_write_bulk_callback(), there is | ||
153 | * a race condition that could cause the wakeup to fail: if our | ||
154 | * wake_up_interruptible() call occurs between the time that our | ||
155 | * driver write routine finishes and write_chan() sets current->state | ||
156 | * to TASK_INTERRUPTIBLE, the effect of our wakeup setting the state | ||
157 | * to TASK_RUNNING will be lost and write_chan's subsequent call to | ||
158 | * schedule() will never return (unless it catches a signal). | ||
159 | * This race condition occurs because write_bulk_callback() (and thus | ||
160 | * the wakeup) are called asynchronously from an interrupt, rather than | ||
161 | * from the scheduler. We can avoid the race by calling the wakeup | ||
162 | * from the scheduler queue and that's our fix: Now, at the end of | ||
163 | * write_bulk_callback() we queue up a wakeup call on the scheduler | ||
164 | * task queue. We still also invoke the wakeup directly since that | ||
165 | * squeezes a bit more performance out of the driver, and any lost | ||
166 | * race conditions will get cleaned up at the next scheduler run. | ||
167 | * | ||
168 | * NOTE: The problem also goes away if you comment out | ||
169 | * the two code lines in write_chan() where current->state | ||
170 | * is set to TASK_RUNNING just before calling driver.write() and to | ||
171 | * TASK_INTERRUPTIBLE immediately afterwards. This is why the | ||
172 | * problem did not show up with the 2.2 kernels -- they do not | ||
173 | * include that code. | ||
174 | * | ||
175 | * (5/16/2000) pberger and borchers | ||
176 | * -- Added timeouts to sleeps, to defend against lost wake ups. | ||
177 | * -- Handle transition to/from B0 baud rate in digi_set_termios. | ||
178 | * | ||
179 | * (5/13/2000) pberger and borchers | ||
180 | * -- All commands now sent on out of band port, using | ||
181 | * digi_write_oob_command. | ||
182 | * -- Get modem control signals whenever they change, support TIOCMGET/ | ||
183 | * SET/BIS/BIC ioctls. | ||
184 | * -- digi_set_termios now supports parity, word size, stop bits, and | ||
185 | * receive enable. | ||
186 | * -- Cleaned up open and close, use digi_set_termios and | ||
187 | * digi_write_oob_command to set port parameters. | ||
188 | * -- Added digi_startup_device to start read chains on all ports. | ||
189 | * -- Write buffer is only used when count==1, to be sure put_char can | ||
190 | * write a char (unless the buffer is full). | ||
191 | * | ||
192 | * (5/10/2000) pberger and borchers | ||
193 | * -- Added MOD_INC_USE_COUNT/MOD_DEC_USE_COUNT calls on open/close. | ||
194 | * -- Fixed problem where the first incoming character is lost on | ||
195 | * port opens after the first close on that port. Now we keep | ||
196 | * the read_urb chain open until shutdown. | ||
197 | * -- Added more port conditioning calls in digi_open and digi_close. | ||
198 | * -- Convert port->active to a use count so that we can deal with multiple | ||
199 | * opens and closes properly. | ||
200 | * -- Fixed some problems with the locking code. | ||
201 | * | ||
202 | * (5/3/2000) pberger and borchers | ||
203 | * -- First alpha version of the driver--many known limitations and bugs. | ||
204 | * | ||
205 | * | ||
206 | * Locking and SMP | ||
207 | * | ||
208 | * - Each port, including the out-of-band port, has a lock used to | ||
209 | * serialize all access to the port's private structure. | ||
210 | * - The port lock is also used to serialize all writes and access to | ||
211 | * the port's URB. | ||
212 | * - The port lock is also used for the port write_wait condition | ||
213 | * variable. Holding the port lock will prevent a wake up on the | ||
214 | * port's write_wait; this can be used with cond_wait_... to be sure | ||
215 | * the wake up is not lost in a race when dropping the lock and | ||
216 | * sleeping waiting for the wakeup. | ||
217 | * - digi_write() does not sleep, since it is sometimes called on | ||
218 | * interrupt time. | ||
219 | * - digi_write_bulk_callback() and digi_read_bulk_callback() are | ||
220 | * called directly from interrupts. Hence spin_lock_irqsave() | ||
221 | * and spin_unlock_irqrestore() are used in the rest of the code | ||
222 | * for any locks they acquire. | ||
223 | * - digi_write_bulk_callback() gets the port lock before waking up | ||
224 | * processes sleeping on the port write_wait. It also schedules | ||
225 | * wake ups so they happen from the scheduler, because the tty | ||
226 | * system can miss wake ups from interrupts. | ||
227 | * - All sleeps use a timeout of DIGI_RETRY_TIMEOUT before looping to | ||
228 | * recheck the condition they are sleeping on. This is defensive, | ||
229 | * in case a wake up is lost. | ||
230 | * - Following Documentation/DocBook/kernel-locking.tmpl no spin locks | ||
231 | * are held when calling copy_to/from_user or printk. | ||
232 | */ | 16 | */ |
233 | 17 | ||
234 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
@@ -654,7 +438,6 @@ static int digi_write_oob_command(struct usb_serial_port *port, | |||
654 | len &= ~3; | 438 | len &= ~3; |
655 | memcpy(oob_port->write_urb->transfer_buffer, buf, len); | 439 | memcpy(oob_port->write_urb->transfer_buffer, buf, len); |
656 | oob_port->write_urb->transfer_buffer_length = len; | 440 | oob_port->write_urb->transfer_buffer_length = len; |
657 | oob_port->write_urb->dev = port->serial->dev; | ||
658 | ret = usb_submit_urb(oob_port->write_urb, GFP_ATOMIC); | 441 | ret = usb_submit_urb(oob_port->write_urb, GFP_ATOMIC); |
659 | if (ret == 0) { | 442 | if (ret == 0) { |
660 | oob_priv->dp_write_urb_in_use = 1; | 443 | oob_priv->dp_write_urb_in_use = 1; |
@@ -732,7 +515,6 @@ static int digi_write_inb_command(struct usb_serial_port *port, | |||
732 | memcpy(data, buf, len); | 515 | memcpy(data, buf, len); |
733 | port->write_urb->transfer_buffer_length = len; | 516 | port->write_urb->transfer_buffer_length = len; |
734 | } | 517 | } |
735 | port->write_urb->dev = port->serial->dev; | ||
736 | 518 | ||
737 | ret = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 519 | ret = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
738 | if (ret == 0) { | 520 | if (ret == 0) { |
@@ -803,7 +585,6 @@ static int digi_set_modem_signals(struct usb_serial_port *port, | |||
803 | data[7] = 0; | 585 | data[7] = 0; |
804 | 586 | ||
805 | oob_port->write_urb->transfer_buffer_length = 8; | 587 | oob_port->write_urb->transfer_buffer_length = 8; |
806 | oob_port->write_urb->dev = port->serial->dev; | ||
807 | 588 | ||
808 | ret = usb_submit_urb(oob_port->write_urb, GFP_ATOMIC); | 589 | ret = usb_submit_urb(oob_port->write_urb, GFP_ATOMIC); |
809 | if (ret == 0) { | 590 | if (ret == 0) { |
@@ -899,10 +680,8 @@ static void digi_rx_unthrottle(struct tty_struct *tty) | |||
899 | spin_lock_irqsave(&priv->dp_port_lock, flags); | 680 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
900 | 681 | ||
901 | /* restart read chain */ | 682 | /* restart read chain */ |
902 | if (priv->dp_throttle_restart) { | 683 | if (priv->dp_throttle_restart) |
903 | port->read_urb->dev = port->serial->dev; | ||
904 | ret = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 684 | ret = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
905 | } | ||
906 | 685 | ||
907 | /* turn throttle off */ | 686 | /* turn throttle off */ |
908 | priv->dp_throttled = 0; | 687 | priv->dp_throttled = 0; |
@@ -1195,7 +974,6 @@ static int digi_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1195 | } | 974 | } |
1196 | 975 | ||
1197 | port->write_urb->transfer_buffer_length = data_len+2; | 976 | port->write_urb->transfer_buffer_length = data_len+2; |
1198 | port->write_urb->dev = port->serial->dev; | ||
1199 | 977 | ||
1200 | *data++ = DIGI_CMD_SEND_DATA; | 978 | *data++ = DIGI_CMD_SEND_DATA; |
1201 | *data++ = data_len; | 979 | *data++ = data_len; |
@@ -1271,7 +1049,6 @@ static void digi_write_bulk_callback(struct urb *urb) | |||
1271 | = (unsigned char)priv->dp_out_buf_len; | 1049 | = (unsigned char)priv->dp_out_buf_len; |
1272 | port->write_urb->transfer_buffer_length = | 1050 | port->write_urb->transfer_buffer_length = |
1273 | priv->dp_out_buf_len + 2; | 1051 | priv->dp_out_buf_len + 2; |
1274 | port->write_urb->dev = serial->dev; | ||
1275 | memcpy(port->write_urb->transfer_buffer + 2, priv->dp_out_buf, | 1052 | memcpy(port->write_urb->transfer_buffer + 2, priv->dp_out_buf, |
1276 | priv->dp_out_buf_len); | 1053 | priv->dp_out_buf_len); |
1277 | ret = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 1054 | ret = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
@@ -1473,7 +1250,6 @@ static int digi_startup_device(struct usb_serial *serial) | |||
1473 | /* set USB_DISABLE_SPD flag for write bulk urbs */ | 1250 | /* set USB_DISABLE_SPD flag for write bulk urbs */ |
1474 | for (i = 0; i < serial->type->num_ports + 1; i++) { | 1251 | for (i = 0; i < serial->type->num_ports + 1; i++) { |
1475 | port = serial->port[i]; | 1252 | port = serial->port[i]; |
1476 | port->write_urb->dev = port->serial->dev; | ||
1477 | ret = usb_submit_urb(port->read_urb, GFP_KERNEL); | 1253 | ret = usb_submit_urb(port->read_urb, GFP_KERNEL); |
1478 | if (ret != 0) { | 1254 | if (ret != 0) { |
1479 | dev_err(&port->dev, | 1255 | dev_err(&port->dev, |
@@ -1616,7 +1392,6 @@ static void digi_read_bulk_callback(struct urb *urb) | |||
1616 | } | 1392 | } |
1617 | 1393 | ||
1618 | /* continue read */ | 1394 | /* continue read */ |
1619 | urb->dev = port->serial->dev; | ||
1620 | ret = usb_submit_urb(urb, GFP_ATOMIC); | 1395 | ret = usb_submit_urb(urb, GFP_ATOMIC); |
1621 | if (ret != 0 && ret != -EPERM) { | 1396 | if (ret != 0 && ret != -EPERM) { |
1622 | dev_err(&port->dev, | 1397 | dev_err(&port->dev, |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ff3db5d056a5..c290df97108e 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -2105,6 +2105,9 @@ static void ftdi_set_termios(struct tty_struct *tty, | |||
2105 | 2105 | ||
2106 | cflag = termios->c_cflag; | 2106 | cflag = termios->c_cflag; |
2107 | 2107 | ||
2108 | if (old_termios == 0) | ||
2109 | goto no_skip; | ||
2110 | |||
2108 | if (old_termios->c_cflag == termios->c_cflag | 2111 | if (old_termios->c_cflag == termios->c_cflag |
2109 | && old_termios->c_ispeed == termios->c_ispeed | 2112 | && old_termios->c_ispeed == termios->c_ispeed |
2110 | && old_termios->c_ospeed == termios->c_ospeed) | 2113 | && old_termios->c_ospeed == termios->c_ospeed) |
@@ -2118,6 +2121,7 @@ static void ftdi_set_termios(struct tty_struct *tty, | |||
2118 | (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB))) | 2121 | (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB))) |
2119 | goto no_data_parity_stop_changes; | 2122 | goto no_data_parity_stop_changes; |
2120 | 2123 | ||
2124 | no_skip: | ||
2121 | /* Set number of data bits, parity, stop bits */ | 2125 | /* Set number of data bits, parity, stop bits */ |
2122 | 2126 | ||
2123 | urb_value = 0; | 2127 | urb_value = 0; |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 1a49ca9c8ea5..bf12565f8e87 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -901,7 +901,6 @@ static int garmin_init_session(struct usb_serial_port *port) | |||
901 | usb_kill_urb(port->interrupt_in_urb); | 901 | usb_kill_urb(port->interrupt_in_urb); |
902 | 902 | ||
903 | dbg("%s - adding interrupt input", __func__); | 903 | dbg("%s - adding interrupt input", __func__); |
904 | port->interrupt_in_urb->dev = serial->dev; | ||
905 | status = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 904 | status = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
906 | if (status) | 905 | if (status) |
907 | dev_err(&serial->dev->dev, | 906 | dev_err(&serial->dev->dev, |
@@ -1277,7 +1276,6 @@ static void garmin_read_int_callback(struct urb *urb) | |||
1277 | unsigned long flags; | 1276 | unsigned long flags; |
1278 | int retval; | 1277 | int retval; |
1279 | struct usb_serial_port *port = urb->context; | 1278 | struct usb_serial_port *port = urb->context; |
1280 | struct usb_serial *serial = port->serial; | ||
1281 | struct garmin_data *garmin_data_p = usb_get_serial_port_data(port); | 1279 | struct garmin_data *garmin_data_p = usb_get_serial_port_data(port); |
1282 | unsigned char *data = urb->transfer_buffer; | 1280 | unsigned char *data = urb->transfer_buffer; |
1283 | int status = urb->status; | 1281 | int status = urb->status; |
@@ -1311,12 +1309,6 @@ static void garmin_read_int_callback(struct urb *urb) | |||
1311 | if (0 == (garmin_data_p->flags & FLAGS_BULK_IN_ACTIVE)) { | 1309 | if (0 == (garmin_data_p->flags & FLAGS_BULK_IN_ACTIVE)) { |
1312 | 1310 | ||
1313 | /* bulk data available */ | 1311 | /* bulk data available */ |
1314 | usb_fill_bulk_urb(port->read_urb, serial->dev, | ||
1315 | usb_rcvbulkpipe(serial->dev, | ||
1316 | port->bulk_in_endpointAddress), | ||
1317 | port->read_urb->transfer_buffer, | ||
1318 | port->read_urb->transfer_buffer_length, | ||
1319 | garmin_read_bulk_callback, port); | ||
1320 | retval = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 1312 | retval = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
1321 | if (retval) { | 1313 | if (retval) { |
1322 | dev_err(&port->dev, | 1314 | dev_err(&port->dev, |
@@ -1353,7 +1345,6 @@ static void garmin_read_int_callback(struct urb *urb) | |||
1353 | 1345 | ||
1354 | garmin_read_process(garmin_data_p, data, urb->actual_length, 0); | 1346 | garmin_read_process(garmin_data_p, data, urb->actual_length, 0); |
1355 | 1347 | ||
1356 | port->interrupt_in_urb->dev = port->serial->dev; | ||
1357 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 1348 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
1358 | if (retval) | 1349 | if (retval) |
1359 | dev_err(&urb->dev->dev, | 1350 | dev_err(&urb->dev->dev, |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index e4db5ad2bc55..f7403576f99f 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * USB Serial Converter Generic functions | 2 | * USB Serial Converter Generic functions |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Johan Hovold (jhovold@gmail.com) | 4 | * Copyright (C) 2010 - 2011 Johan Hovold (jhovold@gmail.com) |
5 | * Copyright (C) 1999 - 2002 Greg Kroah-Hartman (greg@kroah.com) | 5 | * Copyright (C) 1999 - 2002 Greg Kroah-Hartman (greg@kroah.com) |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
@@ -132,7 +132,7 @@ int usb_serial_generic_open(struct tty_struct *tty, struct usb_serial_port *port | |||
132 | 132 | ||
133 | /* if we have a bulk endpoint, start reading from it */ | 133 | /* if we have a bulk endpoint, start reading from it */ |
134 | if (port->bulk_in_size) | 134 | if (port->bulk_in_size) |
135 | result = usb_serial_generic_submit_read_urb(port, GFP_KERNEL); | 135 | result = usb_serial_generic_submit_read_urbs(port, GFP_KERNEL); |
136 | 136 | ||
137 | return result; | 137 | return result; |
138 | } | 138 | } |
@@ -157,8 +157,10 @@ static void generic_cleanup(struct usb_serial_port *port) | |||
157 | kfifo_reset_out(&port->write_fifo); | 157 | kfifo_reset_out(&port->write_fifo); |
158 | spin_unlock_irqrestore(&port->lock, flags); | 158 | spin_unlock_irqrestore(&port->lock, flags); |
159 | } | 159 | } |
160 | if (port->bulk_in_size) | 160 | if (port->bulk_in_size) { |
161 | usb_kill_urb(port->read_urb); | 161 | for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) |
162 | usb_kill_urb(port->read_urbs[i]); | ||
163 | } | ||
162 | } | 164 | } |
163 | } | 165 | } |
164 | 166 | ||
@@ -308,19 +310,52 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) | |||
308 | return chars; | 310 | return chars; |
309 | } | 311 | } |
310 | 312 | ||
311 | int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, | 313 | static int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, |
314 | int index, gfp_t mem_flags) | ||
315 | { | ||
316 | int res; | ||
317 | |||
318 | if (!test_and_clear_bit(index, &port->read_urbs_free)) | ||
319 | return 0; | ||
320 | |||
321 | dbg("%s - port %d, urb %d\n", __func__, port->number, index); | ||
322 | |||
323 | res = usb_submit_urb(port->read_urbs[index], mem_flags); | ||
324 | if (res) { | ||
325 | if (res != -EPERM) { | ||
326 | dev_err(&port->dev, | ||
327 | "%s - usb_submit_urb failed: %d\n", | ||
328 | __func__, res); | ||
329 | } | ||
330 | set_bit(index, &port->read_urbs_free); | ||
331 | return res; | ||
332 | } | ||
333 | |||
334 | return 0; | ||
335 | } | ||
336 | |||
337 | int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port, | ||
312 | gfp_t mem_flags) | 338 | gfp_t mem_flags) |
313 | { | 339 | { |
314 | int result; | 340 | int res; |
341 | int i; | ||
315 | 342 | ||
316 | result = usb_submit_urb(port->read_urb, mem_flags); | 343 | dbg("%s - port %d", __func__, port->number); |
317 | if (result && result != -EPERM) { | 344 | |
318 | dev_err(&port->dev, "%s - error submitting urb: %d\n", | 345 | for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) { |
319 | __func__, result); | 346 | res = usb_serial_generic_submit_read_urb(port, i, mem_flags); |
347 | if (res) | ||
348 | goto err; | ||
320 | } | 349 | } |
321 | return result; | 350 | |
351 | return 0; | ||
352 | err: | ||
353 | for (; i >= 0; --i) | ||
354 | usb_kill_urb(port->read_urbs[i]); | ||
355 | |||
356 | return res; | ||
322 | } | 357 | } |
323 | EXPORT_SYMBOL_GPL(usb_serial_generic_submit_read_urb); | 358 | EXPORT_SYMBOL_GPL(usb_serial_generic_submit_read_urbs); |
324 | 359 | ||
325 | void usb_serial_generic_process_read_urb(struct urb *urb) | 360 | void usb_serial_generic_process_read_urb(struct urb *urb) |
326 | { | 361 | { |
@@ -356,14 +391,19 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb) | |||
356 | { | 391 | { |
357 | struct usb_serial_port *port = urb->context; | 392 | struct usb_serial_port *port = urb->context; |
358 | unsigned char *data = urb->transfer_buffer; | 393 | unsigned char *data = urb->transfer_buffer; |
359 | int status = urb->status; | ||
360 | unsigned long flags; | 394 | unsigned long flags; |
395 | int i; | ||
361 | 396 | ||
362 | dbg("%s - port %d", __func__, port->number); | 397 | for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) { |
398 | if (urb == port->read_urbs[i]) | ||
399 | break; | ||
400 | } | ||
401 | set_bit(i, &port->read_urbs_free); | ||
363 | 402 | ||
364 | if (unlikely(status != 0)) { | 403 | dbg("%s - port %d, urb %d, len %d\n", __func__, port->number, i, |
365 | dbg("%s - nonzero read bulk status received: %d", | 404 | urb->actual_length); |
366 | __func__, status); | 405 | if (urb->status) { |
406 | dbg("%s - non-zero urb status: %d\n", __func__, urb->status); | ||
367 | return; | 407 | return; |
368 | } | 408 | } |
369 | 409 | ||
@@ -376,7 +416,7 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb) | |||
376 | port->throttled = port->throttle_req; | 416 | port->throttled = port->throttle_req; |
377 | if (!port->throttled) { | 417 | if (!port->throttled) { |
378 | spin_unlock_irqrestore(&port->lock, flags); | 418 | spin_unlock_irqrestore(&port->lock, flags); |
379 | usb_serial_generic_submit_read_urb(port, GFP_ATOMIC); | 419 | usb_serial_generic_submit_read_urb(port, i, GFP_ATOMIC); |
380 | } else | 420 | } else |
381 | spin_unlock_irqrestore(&port->lock, flags); | 421 | spin_unlock_irqrestore(&port->lock, flags); |
382 | } | 422 | } |
@@ -443,7 +483,7 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty) | |||
443 | spin_unlock_irq(&port->lock); | 483 | spin_unlock_irq(&port->lock); |
444 | 484 | ||
445 | if (was_throttled) | 485 | if (was_throttled) |
446 | usb_serial_generic_submit_read_urb(port, GFP_KERNEL); | 486 | usb_serial_generic_submit_read_urbs(port, GFP_KERNEL); |
447 | } | 487 | } |
448 | EXPORT_SYMBOL_GPL(usb_serial_generic_unthrottle); | 488 | EXPORT_SYMBOL_GPL(usb_serial_generic_unthrottle); |
449 | 489 | ||
@@ -509,8 +549,9 @@ int usb_serial_generic_resume(struct usb_serial *serial) | |||
509 | if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags)) | 549 | if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags)) |
510 | continue; | 550 | continue; |
511 | 551 | ||
512 | if (port->read_urb) { | 552 | if (port->bulk_in_size) { |
513 | r = usb_submit_urb(port->read_urb, GFP_NOIO); | 553 | r = usb_serial_generic_submit_read_urbs(port, |
554 | GFP_NOIO); | ||
514 | if (r < 0) | 555 | if (r < 0) |
515 | c++; | 556 | c++; |
516 | } | 557 | } |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 2ee807523f53..abd2ee2b2f99 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -610,7 +610,6 @@ static void edge_interrupt_callback(struct urb *urb) | |||
610 | 610 | ||
611 | /* we have pending bytes on the | 611 | /* we have pending bytes on the |
612 | bulk in pipe, send a request */ | 612 | bulk in pipe, send a request */ |
613 | edge_serial->read_urb->dev = edge_serial->serial->dev; | ||
614 | result = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); | 613 | result = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); |
615 | if (result) { | 614 | if (result) { |
616 | dev_err(&edge_serial->serial->dev->dev, "%s - usb_submit_urb(read bulk) failed with result = %d\n", __func__, result); | 615 | dev_err(&edge_serial->serial->dev->dev, "%s - usb_submit_urb(read bulk) failed with result = %d\n", __func__, result); |
@@ -711,7 +710,6 @@ static void edge_bulk_in_callback(struct urb *urb) | |||
711 | /* check to see if there's any more data for us to read */ | 710 | /* check to see if there's any more data for us to read */ |
712 | if (edge_serial->rxBytesAvail > 0) { | 711 | if (edge_serial->rxBytesAvail > 0) { |
713 | dbg("%s - posting a read", __func__); | 712 | dbg("%s - posting a read", __func__); |
714 | edge_serial->read_urb->dev = edge_serial->serial->dev; | ||
715 | retval = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); | 713 | retval = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); |
716 | if (retval) { | 714 | if (retval) { |
717 | dev_err(&urb->dev->dev, | 715 | dev_err(&urb->dev->dev, |
@@ -1330,7 +1328,6 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, | |||
1330 | edge_port->txCredits -= count; | 1328 | edge_port->txCredits -= count; |
1331 | edge_port->icount.tx += count; | 1329 | edge_port->icount.tx += count; |
1332 | 1330 | ||
1333 | urb->dev = edge_serial->serial->dev; | ||
1334 | status = usb_submit_urb(urb, GFP_ATOMIC); | 1331 | status = usb_submit_urb(urb, GFP_ATOMIC); |
1335 | if (status) { | 1332 | if (status) { |
1336 | /* something went wrong */ | 1333 | /* something went wrong */ |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 0aac00afb5c8..e44d375edaad 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -15,13 +15,6 @@ | |||
15 | * For questions or problems with this driver, contact Inside Out | 15 | * For questions or problems with this driver, contact Inside Out |
16 | * Networks technical support, or Peter Berger <pberger@brimson.com>, | 16 | * Networks technical support, or Peter Berger <pberger@brimson.com>, |
17 | * or Al Borchers <alborchers@steinerpoint.com>. | 17 | * or Al Borchers <alborchers@steinerpoint.com>. |
18 | * | ||
19 | * Version history: | ||
20 | * | ||
21 | * July 11, 2002 Removed 4 port device structure since all TI UMP | ||
22 | * chips have only 2 ports | ||
23 | * David Iacovelli (davidi@ionetworks.com) | ||
24 | * | ||
25 | */ | 18 | */ |
26 | 19 | ||
27 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
@@ -1777,12 +1770,11 @@ static void edge_bulk_in_callback(struct urb *urb) | |||
1777 | exit: | 1770 | exit: |
1778 | /* continue read unless stopped */ | 1771 | /* continue read unless stopped */ |
1779 | spin_lock(&edge_port->ep_lock); | 1772 | spin_lock(&edge_port->ep_lock); |
1780 | if (edge_port->ep_read_urb_state == EDGE_READ_URB_RUNNING) { | 1773 | if (edge_port->ep_read_urb_state == EDGE_READ_URB_RUNNING) |
1781 | urb->dev = edge_port->port->serial->dev; | ||
1782 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 1774 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
1783 | } else if (edge_port->ep_read_urb_state == EDGE_READ_URB_STOPPING) { | 1775 | else if (edge_port->ep_read_urb_state == EDGE_READ_URB_STOPPING) |
1784 | edge_port->ep_read_urb_state = EDGE_READ_URB_STOPPED; | 1776 | edge_port->ep_read_urb_state = EDGE_READ_URB_STOPPED; |
1785 | } | 1777 | |
1786 | spin_unlock(&edge_port->ep_lock); | 1778 | spin_unlock(&edge_port->ep_lock); |
1787 | if (retval) | 1779 | if (retval) |
1788 | dev_err(&urb->dev->dev, | 1780 | dev_err(&urb->dev->dev, |
@@ -1959,9 +1951,7 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1959 | status = -EINVAL; | 1951 | status = -EINVAL; |
1960 | goto release_es_lock; | 1952 | goto release_es_lock; |
1961 | } | 1953 | } |
1962 | urb->complete = edge_interrupt_callback; | ||
1963 | urb->context = edge_serial; | 1954 | urb->context = edge_serial; |
1964 | urb->dev = dev; | ||
1965 | status = usb_submit_urb(urb, GFP_KERNEL); | 1955 | status = usb_submit_urb(urb, GFP_KERNEL); |
1966 | if (status) { | 1956 | if (status) { |
1967 | dev_err(&port->dev, | 1957 | dev_err(&port->dev, |
@@ -1987,9 +1977,7 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1987 | goto unlink_int_urb; | 1977 | goto unlink_int_urb; |
1988 | } | 1978 | } |
1989 | edge_port->ep_read_urb_state = EDGE_READ_URB_RUNNING; | 1979 | edge_port->ep_read_urb_state = EDGE_READ_URB_RUNNING; |
1990 | urb->complete = edge_bulk_in_callback; | ||
1991 | urb->context = edge_port; | 1980 | urb->context = edge_port; |
1992 | urb->dev = dev; | ||
1993 | status = usb_submit_urb(urb, GFP_KERNEL); | 1981 | status = usb_submit_urb(urb, GFP_KERNEL); |
1994 | if (status) { | 1982 | if (status) { |
1995 | dev_err(&port->dev, | 1983 | dev_err(&port->dev, |
@@ -2118,12 +2106,7 @@ static void edge_send(struct tty_struct *tty) | |||
2118 | port->write_urb->transfer_buffer); | 2106 | port->write_urb->transfer_buffer); |
2119 | 2107 | ||
2120 | /* set up our urb */ | 2108 | /* set up our urb */ |
2121 | usb_fill_bulk_urb(port->write_urb, port->serial->dev, | 2109 | port->write_urb->transfer_buffer_length = count; |
2122 | usb_sndbulkpipe(port->serial->dev, | ||
2123 | port->bulk_out_endpointAddress), | ||
2124 | port->write_urb->transfer_buffer, count, | ||
2125 | edge_bulk_out_callback, | ||
2126 | port); | ||
2127 | 2110 | ||
2128 | /* send the data out the bulk port */ | 2111 | /* send the data out the bulk port */ |
2129 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 2112 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
@@ -2267,9 +2250,6 @@ static int restart_read(struct edgeport_port *edge_port) | |||
2267 | 2250 | ||
2268 | if (edge_port->ep_read_urb_state == EDGE_READ_URB_STOPPED) { | 2251 | if (edge_port->ep_read_urb_state == EDGE_READ_URB_STOPPED) { |
2269 | urb = edge_port->port->read_urb; | 2252 | urb = edge_port->port->read_urb; |
2270 | urb->complete = edge_bulk_in_callback; | ||
2271 | urb->context = edge_port; | ||
2272 | urb->dev = edge_port->port->serial->dev; | ||
2273 | status = usb_submit_urb(urb, GFP_ATOMIC); | 2253 | status = usb_submit_urb(urb, GFP_ATOMIC); |
2274 | } | 2254 | } |
2275 | edge_port->ep_read_urb_state = EDGE_READ_URB_RUNNING; | 2255 | edge_port->ep_read_urb_state = EDGE_READ_URB_RUNNING; |
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index 4735931b4c7b..36f5cbe90485 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -8,40 +8,6 @@ | |||
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or | 9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. | 10 | * (at your option) any later version. |
11 | * | ||
12 | * (12/12/2002) ganesh | ||
13 | * Added support for practically all devices supported by ActiveSync | ||
14 | * on Windows. Thanks to Wes Cilldhaire <billybobjoehenrybob@hotmail.com>. | ||
15 | * | ||
16 | * (26/11/2002) ganesh | ||
17 | * Added insmod options to specify product and vendor id. | ||
18 | * Use modprobe ipaq vendor=0xfoo product=0xbar | ||
19 | * | ||
20 | * (26/7/2002) ganesh | ||
21 | * Fixed up broken error handling in ipaq_open. Retry the "kickstart" | ||
22 | * packet much harder - this drastically reduces connection failures. | ||
23 | * | ||
24 | * (30/4/2002) ganesh | ||
25 | * Added support for the Casio EM500. Completely untested. Thanks | ||
26 | * to info from Nathan <wfilardo@fuse.net> | ||
27 | * | ||
28 | * (19/3/2002) ganesh | ||
29 | * Don't submit urbs while holding spinlocks. Not strictly necessary | ||
30 | * in 2.5.x. | ||
31 | * | ||
32 | * (8/3/2002) ganesh | ||
33 | * The ipaq sometimes emits a '\0' before the CLIENT string. At this | ||
34 | * point of time, the ppp ldisc is not yet attached to the tty, so | ||
35 | * n_tty echoes "^ " to the ipaq, which messes up the chat. In 2.5.6-pre2 | ||
36 | * this causes a panic because echo_char() tries to sleep in interrupt | ||
37 | * context. | ||
38 | * The fix is to tell the upper layers that this is a raw device so that | ||
39 | * echoing is suppressed. Thanks to Lyle Lindholm for a detailed bug | ||
40 | * report. | ||
41 | * | ||
42 | * (25/2/2002) ganesh | ||
43 | * Added support for the HP Jornada 548 and 568. Completely untested. | ||
44 | * Thanks to info from Heath Robinson and Arieh Davidoff. | ||
45 | */ | 11 | */ |
46 | 12 | ||
47 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index ccbce4066d04..0c537da0d3cd 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c | |||
@@ -22,38 +22,6 @@ | |||
22 | * | 22 | * |
23 | * See Documentation/usb/usb-serial.txt for more information on using this | 23 | * See Documentation/usb/usb-serial.txt for more information on using this |
24 | * driver | 24 | * driver |
25 | * | ||
26 | * 2008_Jun_02 Felipe Balbi <me@felipebalbi.com> | ||
27 | * Introduced common header to be used also in USB Gadget Framework. | ||
28 | * Still needs some other style fixes. | ||
29 | * | ||
30 | * 2007_Jun_21 Alan Cox <alan@lxorguk.ukuu.org.uk> | ||
31 | * Minimal cleanups for some of the driver problens and tty layer abuse. | ||
32 | * Still needs fixing to allow multiple dongles. | ||
33 | * | ||
34 | * 2002_Mar_07 greg kh | ||
35 | * moved some needed structures and #define values from the | ||
36 | * net/irda/irda-usb.h file into our file, as we don't want to depend on | ||
37 | * that codebase compiling correctly :) | ||
38 | * | ||
39 | * 2002_Jan_14 gb | ||
40 | * Added module parameter to force specific number of XBOFs. | ||
41 | * Added ir_xbof_change(). | ||
42 | * Reorganized read_bulk_callback error handling. | ||
43 | * Switched from FILL_BULK_URB() to usb_fill_bulk_urb(). | ||
44 | * | ||
45 | * 2001_Nov_08 greg kh | ||
46 | * Changed the irda_usb_find_class_desc() function based on comments and | ||
47 | * code from Martin Diehl. | ||
48 | * | ||
49 | * 2001_Nov_01 greg kh | ||
50 | * Added support for more IrDA USB devices. | ||
51 | * Added support for zero packet. Added buffer override paramater, so | ||
52 | * users can transfer larger packets at once if they wish. Both patches | ||
53 | * came from Dag Brattli <dag@obexcode.com>. | ||
54 | * | ||
55 | * 2001_Oct_07 greg kh | ||
56 | * initial version released. | ||
57 | */ | 25 | */ |
58 | 26 | ||
59 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 6aca631a407a..64d0ffd4440b 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c | |||
@@ -1168,15 +1168,14 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1168 | port->write_urb->transfer_buffer, 1, | 1168 | port->write_urb->transfer_buffer, 1, |
1169 | read_rxcmd_callback, port); | 1169 | read_rxcmd_callback, port); |
1170 | result = usb_submit_urb(port->write_urb, GFP_KERNEL); | 1170 | result = usb_submit_urb(port->write_urb, GFP_KERNEL); |
1171 | |||
1172 | if (result) { | 1171 | if (result) { |
1173 | dev_err(&port->dev, "%s - failed submitting read urb," | 1172 | dev_err(&port->dev, "%s - failed submitting read urb," |
1174 | " error %d\n", __func__, result); | 1173 | " error %d\n", __func__, result); |
1175 | iuu_close(port); | 1174 | iuu_close(port); |
1176 | return -EPROTO; | ||
1177 | } else { | 1175 | } else { |
1178 | dbg("%s - rxcmd OK", __func__); | 1176 | dbg("%s - rxcmd OK", __func__); |
1179 | } | 1177 | } |
1178 | |||
1180 | return result; | 1179 | return result; |
1181 | } | 1180 | } |
1182 | 1181 | ||
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index a442352d7b61..bc8dc203e818 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -25,73 +25,6 @@ | |||
25 | 25 | ||
26 | Tip 'o the hat to IBM (and previously Linuxcare :) for supporting | 26 | Tip 'o the hat to IBM (and previously Linuxcare :) for supporting |
27 | staff in their work on open source projects. | 27 | staff in their work on open source projects. |
28 | |||
29 | Change History | ||
30 | |||
31 | 2003sep04 LPM (Keyspan) add support for new single port product USA19HS. | ||
32 | Improve setup message handling for all devices. | ||
33 | |||
34 | Wed Feb 19 22:00:00 PST 2003 (Jeffrey S. Laing <keyspan@jsl.com>) | ||
35 | Merged the current (1/31/03) Keyspan code with the current (2.4.21-pre4) | ||
36 | Linux source tree. The Linux tree lacked support for the 49WLC and | ||
37 | others. The Keyspan patches didn't work with the current kernel. | ||
38 | |||
39 | 2003jan30 LPM add support for the 49WLC and MPR | ||
40 | |||
41 | Wed Apr 25 12:00:00 PST 2002 (Keyspan) | ||
42 | Started with Hugh Blemings' code dated Jan 17, 2002. All adapters | ||
43 | now supported (including QI and QW). Modified port open, port | ||
44 | close, and send setup() logic to fix various data and endpoint | ||
45 | synchronization bugs and device LED status bugs. Changed keyspan_ | ||
46 | write_room() to accurately return transmit buffer availability. | ||
47 | Changed forwardingLength from 1 to 16 for all adapters. | ||
48 | |||
49 | Fri Oct 12 16:45:00 EST 2001 | ||
50 | Preliminary USA-19QI and USA-28 support (both test OK for me, YMMV) | ||
51 | |||
52 | Wed Apr 25 12:00:00 PST 2002 (Keyspan) | ||
53 | Started with Hugh Blemings' code dated Jan 17, 2002. All adapters | ||
54 | now supported (including QI and QW). Modified port open, port | ||
55 | close, and send setup() logic to fix various data and endpoint | ||
56 | synchronization bugs and device LED status bugs. Changed keyspan_ | ||
57 | write_room() to accurately return transmit buffer availability. | ||
58 | Changed forwardingLength from 1 to 16 for all adapters. | ||
59 | |||
60 | Fri Oct 12 16:45:00 EST 2001 | ||
61 | Preliminary USA-19QI and USA-28 support (both test OK for me, YMMV) | ||
62 | |||
63 | Mon Oct 8 14:29:00 EST 2001 hugh | ||
64 | Fixed bug that prevented mulitport devices operating correctly | ||
65 | if they weren't the first unit attached. | ||
66 | |||
67 | Sat Oct 6 12:31:21 EST 2001 hugh | ||
68 | Added support for USA-28XA and -28XB, misc cleanups, break support | ||
69 | for usa26 based models thanks to David Gibson. | ||
70 | |||
71 | Thu May 31 11:56:42 PDT 2001 gkh | ||
72 | switched from using spinlock to a semaphore | ||
73 | |||
74 | (04/08/2001) gb | ||
75 | Identify version on module load. | ||
76 | |||
77 | (11/01/2000) Adam J. Richter | ||
78 | usb_device_id table support. | ||
79 | |||
80 | Tue Oct 10 23:15:33 EST 2000 Hugh | ||
81 | Merged Paul's changes with my USA-49W mods. Work in progress | ||
82 | still... | ||
83 | |||
84 | Wed Jul 19 14:00:42 EST 2000 gkh | ||
85 | Added module_init and module_exit functions to handle the fact that | ||
86 | this driver is a loadable module now. | ||
87 | |||
88 | Tue Jul 18 16:14:52 EST 2000 Hugh | ||
89 | Basic character input/output for USA-19 now mostly works, | ||
90 | fixed at 9600 baud for the moment. | ||
91 | |||
92 | Sat Jul 8 11:11:48 EST 2000 Hugh | ||
93 | First public release - nothing works except the firmware upload. | ||
94 | Tested on PPC and x86 architectures, seems to behave... | ||
95 | */ | 28 | */ |
96 | 29 | ||
97 | 30 | ||
@@ -397,7 +330,6 @@ static int keyspan_write(struct tty_struct *tty, | |||
397 | /* send the data out the bulk port */ | 330 | /* send the data out the bulk port */ |
398 | this_urb->transfer_buffer_length = todo + dataOffset; | 331 | this_urb->transfer_buffer_length = todo + dataOffset; |
399 | 332 | ||
400 | this_urb->dev = port->serial->dev; | ||
401 | err = usb_submit_urb(this_urb, GFP_ATOMIC); | 333 | err = usb_submit_urb(this_urb, GFP_ATOMIC); |
402 | if (err != 0) | 334 | if (err != 0) |
403 | dbg("usb_submit_urb(write bulk) failed (%d)", err); | 335 | dbg("usb_submit_urb(write bulk) failed (%d)", err); |
@@ -463,7 +395,6 @@ static void usa26_indat_callback(struct urb *urb) | |||
463 | tty_kref_put(tty); | 395 | tty_kref_put(tty); |
464 | 396 | ||
465 | /* Resubmit urb so we continue receiving */ | 397 | /* Resubmit urb so we continue receiving */ |
466 | urb->dev = port->serial->dev; | ||
467 | err = usb_submit_urb(urb, GFP_ATOMIC); | 398 | err = usb_submit_urb(urb, GFP_ATOMIC); |
468 | if (err != 0) | 399 | if (err != 0) |
469 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); | 400 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); |
@@ -559,7 +490,6 @@ static void usa26_instat_callback(struct urb *urb) | |||
559 | } | 490 | } |
560 | 491 | ||
561 | /* Resubmit urb so we continue receiving */ | 492 | /* Resubmit urb so we continue receiving */ |
562 | urb->dev = serial->dev; | ||
563 | err = usb_submit_urb(urb, GFP_ATOMIC); | 493 | err = usb_submit_urb(urb, GFP_ATOMIC); |
564 | if (err != 0) | 494 | if (err != 0) |
565 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); | 495 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); |
@@ -609,7 +539,6 @@ static void usa28_indat_callback(struct urb *urb) | |||
609 | tty_kref_put(tty); | 539 | tty_kref_put(tty); |
610 | 540 | ||
611 | /* Resubmit urb so we continue receiving */ | 541 | /* Resubmit urb so we continue receiving */ |
612 | urb->dev = port->serial->dev; | ||
613 | err = usb_submit_urb(urb, GFP_ATOMIC); | 542 | err = usb_submit_urb(urb, GFP_ATOMIC); |
614 | if (err != 0) | 543 | if (err != 0) |
615 | dbg("%s - resubmit read urb failed. (%d)", | 544 | dbg("%s - resubmit read urb failed. (%d)", |
@@ -694,7 +623,6 @@ static void usa28_instat_callback(struct urb *urb) | |||
694 | } | 623 | } |
695 | 624 | ||
696 | /* Resubmit urb so we continue receiving */ | 625 | /* Resubmit urb so we continue receiving */ |
697 | urb->dev = serial->dev; | ||
698 | err = usb_submit_urb(urb, GFP_ATOMIC); | 626 | err = usb_submit_urb(urb, GFP_ATOMIC); |
699 | if (err != 0) | 627 | if (err != 0) |
700 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); | 628 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); |
@@ -789,8 +717,6 @@ static void usa49_instat_callback(struct urb *urb) | |||
789 | } | 717 | } |
790 | 718 | ||
791 | /* Resubmit urb so we continue receiving */ | 719 | /* Resubmit urb so we continue receiving */ |
792 | urb->dev = serial->dev; | ||
793 | |||
794 | err = usb_submit_urb(urb, GFP_ATOMIC); | 720 | err = usb_submit_urb(urb, GFP_ATOMIC); |
795 | if (err != 0) | 721 | if (err != 0) |
796 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); | 722 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); |
@@ -848,7 +774,6 @@ static void usa49_indat_callback(struct urb *urb) | |||
848 | tty_kref_put(tty); | 774 | tty_kref_put(tty); |
849 | 775 | ||
850 | /* Resubmit urb so we continue receiving */ | 776 | /* Resubmit urb so we continue receiving */ |
851 | urb->dev = port->serial->dev; | ||
852 | err = usb_submit_urb(urb, GFP_ATOMIC); | 777 | err = usb_submit_urb(urb, GFP_ATOMIC); |
853 | if (err != 0) | 778 | if (err != 0) |
854 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); | 779 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); |
@@ -919,8 +844,6 @@ static void usa49wg_indat_callback(struct urb *urb) | |||
919 | } | 844 | } |
920 | 845 | ||
921 | /* Resubmit urb so we continue receiving */ | 846 | /* Resubmit urb so we continue receiving */ |
922 | urb->dev = serial->dev; | ||
923 | |||
924 | err = usb_submit_urb(urb, GFP_ATOMIC); | 847 | err = usb_submit_urb(urb, GFP_ATOMIC); |
925 | if (err != 0) | 848 | if (err != 0) |
926 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); | 849 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); |
@@ -996,7 +919,6 @@ static void usa90_indat_callback(struct urb *urb) | |||
996 | } | 919 | } |
997 | 920 | ||
998 | /* Resubmit urb so we continue receiving */ | 921 | /* Resubmit urb so we continue receiving */ |
999 | urb->dev = port->serial->dev; | ||
1000 | err = usb_submit_urb(urb, GFP_ATOMIC); | 922 | err = usb_submit_urb(urb, GFP_ATOMIC); |
1001 | if (err != 0) | 923 | if (err != 0) |
1002 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); | 924 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); |
@@ -1047,7 +969,6 @@ static void usa90_instat_callback(struct urb *urb) | |||
1047 | } | 969 | } |
1048 | 970 | ||
1049 | /* Resubmit urb so we continue receiving */ | 971 | /* Resubmit urb so we continue receiving */ |
1050 | urb->dev = serial->dev; | ||
1051 | err = usb_submit_urb(urb, GFP_ATOMIC); | 972 | err = usb_submit_urb(urb, GFP_ATOMIC); |
1052 | if (err != 0) | 973 | if (err != 0) |
1053 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); | 974 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); |
@@ -1123,7 +1044,6 @@ static void usa67_instat_callback(struct urb *urb) | |||
1123 | } | 1044 | } |
1124 | 1045 | ||
1125 | /* Resubmit urb so we continue receiving */ | 1046 | /* Resubmit urb so we continue receiving */ |
1126 | urb->dev = serial->dev; | ||
1127 | err = usb_submit_urb(urb, GFP_ATOMIC); | 1047 | err = usb_submit_urb(urb, GFP_ATOMIC); |
1128 | if (err != 0) | 1048 | if (err != 0) |
1129 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); | 1049 | dbg("%s - resubmit read urb failed. (%d)", __func__, err); |
@@ -1223,7 +1143,6 @@ static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1223 | urb = p_priv->in_urbs[i]; | 1143 | urb = p_priv->in_urbs[i]; |
1224 | if (urb == NULL) | 1144 | if (urb == NULL) |
1225 | continue; | 1145 | continue; |
1226 | urb->dev = serial->dev; | ||
1227 | 1146 | ||
1228 | /* make sure endpoint data toggle is synchronized | 1147 | /* make sure endpoint data toggle is synchronized |
1229 | with the device */ | 1148 | with the device */ |
@@ -1239,7 +1158,6 @@ static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1239 | urb = p_priv->out_urbs[i]; | 1158 | urb = p_priv->out_urbs[i]; |
1240 | if (urb == NULL) | 1159 | if (urb == NULL) |
1241 | continue; | 1160 | continue; |
1242 | urb->dev = serial->dev; | ||
1243 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), | 1161 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), |
1244 | usb_pipeout(urb->pipe), 0); */ | 1162 | usb_pipeout(urb->pipe), 0); */ |
1245 | } | 1163 | } |
@@ -1956,7 +1874,6 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, | |||
1956 | /* send the data out the device on control endpoint */ | 1874 | /* send the data out the device on control endpoint */ |
1957 | this_urb->transfer_buffer_length = sizeof(msg); | 1875 | this_urb->transfer_buffer_length = sizeof(msg); |
1958 | 1876 | ||
1959 | this_urb->dev = serial->dev; | ||
1960 | err = usb_submit_urb(this_urb, GFP_ATOMIC); | 1877 | err = usb_submit_urb(this_urb, GFP_ATOMIC); |
1961 | if (err != 0) | 1878 | if (err != 0) |
1962 | dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); | 1879 | dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); |
@@ -2084,7 +2001,6 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, | |||
2084 | /* send the data out the device on control endpoint */ | 2001 | /* send the data out the device on control endpoint */ |
2085 | this_urb->transfer_buffer_length = sizeof(msg); | 2002 | this_urb->transfer_buffer_length = sizeof(msg); |
2086 | 2003 | ||
2087 | this_urb->dev = serial->dev; | ||
2088 | err = usb_submit_urb(this_urb, GFP_ATOMIC); | 2004 | err = usb_submit_urb(this_urb, GFP_ATOMIC); |
2089 | if (err != 0) | 2005 | if (err != 0) |
2090 | dbg("%s - usb_submit_urb(setup) failed", __func__); | 2006 | dbg("%s - usb_submit_urb(setup) failed", __func__); |
@@ -2271,8 +2187,6 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, | |||
2271 | 2187 | ||
2272 | /* send the data out the device on control endpoint */ | 2188 | /* send the data out the device on control endpoint */ |
2273 | this_urb->transfer_buffer_length = sizeof(msg); | 2189 | this_urb->transfer_buffer_length = sizeof(msg); |
2274 | |||
2275 | this_urb->dev = serial->dev; | ||
2276 | } | 2190 | } |
2277 | err = usb_submit_urb(this_urb, GFP_ATOMIC); | 2191 | err = usb_submit_urb(this_urb, GFP_ATOMIC); |
2278 | if (err != 0) | 2192 | if (err != 0) |
@@ -2415,7 +2329,6 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial, | |||
2415 | /* send the data out the device on control endpoint */ | 2329 | /* send the data out the device on control endpoint */ |
2416 | this_urb->transfer_buffer_length = sizeof(msg); | 2330 | this_urb->transfer_buffer_length = sizeof(msg); |
2417 | 2331 | ||
2418 | this_urb->dev = serial->dev; | ||
2419 | err = usb_submit_urb(this_urb, GFP_ATOMIC); | 2332 | err = usb_submit_urb(this_urb, GFP_ATOMIC); |
2420 | if (err != 0) | 2333 | if (err != 0) |
2421 | dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); | 2334 | dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); |
@@ -2561,7 +2474,6 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial, | |||
2561 | 2474 | ||
2562 | /* send the data out the device on control endpoint */ | 2475 | /* send the data out the device on control endpoint */ |
2563 | this_urb->transfer_buffer_length = sizeof(msg); | 2476 | this_urb->transfer_buffer_length = sizeof(msg); |
2564 | this_urb->dev = serial->dev; | ||
2565 | 2477 | ||
2566 | err = usb_submit_urb(this_urb, GFP_ATOMIC); | 2478 | err = usb_submit_urb(this_urb, GFP_ATOMIC); |
2567 | if (err != 0) | 2479 | if (err != 0) |
@@ -2650,14 +2562,12 @@ static int keyspan_startup(struct usb_serial *serial) | |||
2650 | keyspan_setup_urbs(serial); | 2562 | keyspan_setup_urbs(serial); |
2651 | 2563 | ||
2652 | if (s_priv->instat_urb != NULL) { | 2564 | if (s_priv->instat_urb != NULL) { |
2653 | s_priv->instat_urb->dev = serial->dev; | ||
2654 | err = usb_submit_urb(s_priv->instat_urb, GFP_KERNEL); | 2565 | err = usb_submit_urb(s_priv->instat_urb, GFP_KERNEL); |
2655 | if (err != 0) | 2566 | if (err != 0) |
2656 | dbg("%s - submit instat urb failed %d", __func__, | 2567 | dbg("%s - submit instat urb failed %d", __func__, |
2657 | err); | 2568 | err); |
2658 | } | 2569 | } |
2659 | if (s_priv->indat_urb != NULL) { | 2570 | if (s_priv->indat_urb != NULL) { |
2660 | s_priv->indat_urb->dev = serial->dev; | ||
2661 | err = usb_submit_urb(s_priv->indat_urb, GFP_KERNEL); | 2571 | err = usb_submit_urb(s_priv->indat_urb, GFP_KERNEL); |
2662 | if (err != 0) | 2572 | if (err != 0) |
2663 | dbg("%s - submit indat urb failed %d", __func__, | 2573 | dbg("%s - submit indat urb failed %d", __func__, |
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index d5c0c6ab4966..a40615674a68 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -12,59 +12,6 @@ | |||
12 | * | 12 | * |
13 | * See Documentation/usb/usb-serial.txt for more information on using this | 13 | * See Documentation/usb/usb-serial.txt for more information on using this |
14 | * driver | 14 | * driver |
15 | * | ||
16 | * (09/07/2001) gkh | ||
17 | * cleaned up the Xircom support. Added ids for Entregra device which is | ||
18 | * the same as the Xircom device. Enabled the code to be compiled for | ||
19 | * either Xircom or Keyspan devices. | ||
20 | * | ||
21 | * (08/11/2001) Cristian M. Craciunescu | ||
22 | * support for Xircom PGSDB9 | ||
23 | * | ||
24 | * (05/31/2001) gkh | ||
25 | * switched from using spinlock to a semaphore, which fixes lots of | ||
26 | * problems. | ||
27 | * | ||
28 | * (04/08/2001) gb | ||
29 | * Identify version on module load. | ||
30 | * | ||
31 | * (11/01/2000) Adam J. Richter | ||
32 | * usb_device_id table support | ||
33 | * | ||
34 | * (10/05/2000) gkh | ||
35 | * Fixed bug with urb->dev not being set properly, now that the usb | ||
36 | * core needs it. | ||
37 | * | ||
38 | * (08/28/2000) gkh | ||
39 | * Added locks for SMP safeness. | ||
40 | * Fixed MOD_INC and MOD_DEC logic and the ability to open a port more | ||
41 | * than once. | ||
42 | * | ||
43 | * (07/20/2000) borchers | ||
44 | * - keyspan_pda_write no longer sleeps if it is called on interrupt time; | ||
45 | * PPP and the line discipline with stty echo on can call write on | ||
46 | * interrupt time and this would cause an oops if write slept | ||
47 | * - if keyspan_pda_write is in an interrupt, it will not call | ||
48 | * usb_control_msg (which sleeps) to query the room in the device | ||
49 | * buffer, it simply uses the current room value it has | ||
50 | * - if the urb is busy or if it is throttled keyspan_pda_write just | ||
51 | * returns 0, rather than sleeping to wait for this to change; the | ||
52 | * write_chan code in n_tty.c will sleep if needed before calling | ||
53 | * keyspan_pda_write again | ||
54 | * - if the device needs to be unthrottled, write now queues up the | ||
55 | * call to usb_control_msg (which sleeps) to unthrottle the device | ||
56 | * - the wakeups from keyspan_pda_write_bulk_callback are queued rather | ||
57 | * than done directly from the callback to avoid the race in write_chan | ||
58 | * - keyspan_pda_chars_in_buffer also indicates its buffer is full if the | ||
59 | * urb status is -EINPROGRESS, meaning it cannot write at the moment | ||
60 | * | ||
61 | * (07/19/2000) gkh | ||
62 | * Added module_init and module_exit functions to handle the fact that this | ||
63 | * driver is a loadable module now. | ||
64 | * | ||
65 | * (03/26/2000) gkh | ||
66 | * Split driver up into device specific pieces. | ||
67 | * | ||
68 | */ | 15 | */ |
69 | 16 | ||
70 | 17 | ||
@@ -290,7 +237,6 @@ static void keyspan_pda_rx_unthrottle(struct tty_struct *tty) | |||
290 | struct usb_serial_port *port = tty->driver_data; | 237 | struct usb_serial_port *port = tty->driver_data; |
291 | /* just restart the receive interrupt URB */ | 238 | /* just restart the receive interrupt URB */ |
292 | dbg("keyspan_pda_rx_unthrottle port %d", port->number); | 239 | dbg("keyspan_pda_rx_unthrottle port %d", port->number); |
293 | port->interrupt_in_urb->dev = port->serial->dev; | ||
294 | if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL)) | 240 | if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL)) |
295 | dbg(" usb_submit_urb(read urb) failed"); | 241 | dbg(" usb_submit_urb(read urb) failed"); |
296 | } | 242 | } |
@@ -532,11 +478,11 @@ static int keyspan_pda_write(struct tty_struct *tty, | |||
532 | the device is full (wait until it says there is room) | 478 | the device is full (wait until it says there is room) |
533 | */ | 479 | */ |
534 | spin_lock_bh(&port->lock); | 480 | spin_lock_bh(&port->lock); |
535 | if (port->write_urb_busy || priv->tx_throttled) { | 481 | if (!test_bit(0, &port->write_urbs_free) || priv->tx_throttled) { |
536 | spin_unlock_bh(&port->lock); | 482 | spin_unlock_bh(&port->lock); |
537 | return 0; | 483 | return 0; |
538 | } | 484 | } |
539 | port->write_urb_busy = 1; | 485 | clear_bit(0, &port->write_urbs_free); |
540 | spin_unlock_bh(&port->lock); | 486 | spin_unlock_bh(&port->lock); |
541 | 487 | ||
542 | /* At this point the URB is in our control, nobody else can submit it | 488 | /* At this point the URB is in our control, nobody else can submit it |
@@ -598,7 +544,6 @@ static int keyspan_pda_write(struct tty_struct *tty, | |||
598 | 544 | ||
599 | priv->tx_room -= count; | 545 | priv->tx_room -= count; |
600 | 546 | ||
601 | port->write_urb->dev = port->serial->dev; | ||
602 | rc = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 547 | rc = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
603 | if (rc) { | 548 | if (rc) { |
604 | dbg(" usb_submit_urb(write bulk) failed"); | 549 | dbg(" usb_submit_urb(write bulk) failed"); |
@@ -618,7 +563,7 @@ static int keyspan_pda_write(struct tty_struct *tty, | |||
618 | rc = count; | 563 | rc = count; |
619 | exit: | 564 | exit: |
620 | if (rc < 0) | 565 | if (rc < 0) |
621 | port->write_urb_busy = 0; | 566 | set_bit(0, &port->write_urbs_free); |
622 | return rc; | 567 | return rc; |
623 | } | 568 | } |
624 | 569 | ||
@@ -628,7 +573,7 @@ static void keyspan_pda_write_bulk_callback(struct urb *urb) | |||
628 | struct usb_serial_port *port = urb->context; | 573 | struct usb_serial_port *port = urb->context; |
629 | struct keyspan_pda_private *priv; | 574 | struct keyspan_pda_private *priv; |
630 | 575 | ||
631 | port->write_urb_busy = 0; | 576 | set_bit(0, &port->write_urbs_free); |
632 | priv = usb_get_serial_port_data(port); | 577 | priv = usb_get_serial_port_data(port); |
633 | 578 | ||
634 | /* queue up a wakeup at scheduler time */ | 579 | /* queue up a wakeup at scheduler time */ |
@@ -661,7 +606,7 @@ static int keyspan_pda_chars_in_buffer(struct tty_struct *tty) | |||
661 | n_tty.c:normal_poll() ) that we're not writeable. */ | 606 | n_tty.c:normal_poll() ) that we're not writeable. */ |
662 | 607 | ||
663 | spin_lock_irqsave(&port->lock, flags); | 608 | spin_lock_irqsave(&port->lock, flags); |
664 | if (port->write_urb_busy || priv->tx_throttled) | 609 | if (!test_bit(0, &port->write_urbs_free) || priv->tx_throttled) |
665 | ret = 256; | 610 | ret = 256; |
666 | spin_unlock_irqrestore(&port->lock, flags); | 611 | spin_unlock_irqrestore(&port->lock, flags); |
667 | return ret; | 612 | return ret; |
@@ -717,7 +662,6 @@ static int keyspan_pda_open(struct tty_struct *tty, | |||
717 | priv->tx_throttled = *room ? 0 : 1; | 662 | priv->tx_throttled = *room ? 0 : 1; |
718 | 663 | ||
719 | /*Start reading from the device*/ | 664 | /*Start reading from the device*/ |
720 | port->interrupt_in_urb->dev = serial->dev; | ||
721 | rc = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 665 | rc = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
722 | if (rc) { | 666 | if (rc) { |
723 | dbg("%s - usb_submit_urb(read int) failed", __func__); | 667 | dbg("%s - usb_submit_urb(read int) failed", __func__); |
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index ddd146300ddb..5d3beeeb5fd9 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
@@ -20,18 +20,6 @@ | |||
20 | * | 20 | * |
21 | * Supported readers: USB TWIN, KAAN Standard Plus and SecOVID Reader Plus | 21 | * Supported readers: USB TWIN, KAAN Standard Plus and SecOVID Reader Plus |
22 | * (Adapter K), B1 Professional and KAAN Professional (Adapter B) | 22 | * (Adapter K), B1 Professional and KAAN Professional (Adapter B) |
23 | * | ||
24 | * (21/05/2004) tw | ||
25 | * Fix bug with P'n'P readers | ||
26 | * | ||
27 | * (28/05/2003) tw | ||
28 | * Add support for KAAN SIM | ||
29 | * | ||
30 | * (12/09/2002) tw | ||
31 | * Adapted to 2.5. | ||
32 | * | ||
33 | * (11/08/2002) tw | ||
34 | * Initial version. | ||
35 | */ | 23 | */ |
36 | 24 | ||
37 | 25 | ||
@@ -231,9 +219,6 @@ static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
231 | dbg("%s - port %d", __func__, port->number); | 219 | dbg("%s - port %d", __func__, port->number); |
232 | priv = usb_get_serial_port_data(port); | 220 | priv = usb_get_serial_port_data(port); |
233 | 221 | ||
234 | /* someone sets the dev to 0 if the close method has been called */ | ||
235 | port->interrupt_in_urb->dev = port->serial->dev; | ||
236 | |||
237 | /* allocate memory for transfer buffer */ | 222 | /* allocate memory for transfer buffer */ |
238 | transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL); | 223 | transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL); |
239 | if (!transfer_buffer) | 224 | if (!transfer_buffer) |
@@ -393,8 +378,6 @@ static void kobil_read_int_callback(struct urb *urb) | |||
393 | tty_flip_buffer_push(tty); | 378 | tty_flip_buffer_push(tty); |
394 | } | 379 | } |
395 | tty_kref_put(tty); | 380 | tty_kref_put(tty); |
396 | /* someone sets the dev to 0 if the close method has been called */ | ||
397 | port->interrupt_in_urb->dev = port->serial->dev; | ||
398 | 381 | ||
399 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); | 382 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); |
400 | dbg("%s - port %d Send read URB returns: %i", | 383 | dbg("%s - port %d Send read URB returns: %i", |
@@ -475,17 +458,9 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
475 | priv->filled = 0; | 458 | priv->filled = 0; |
476 | priv->cur_pos = 0; | 459 | priv->cur_pos = 0; |
477 | 460 | ||
478 | /* someone sets the dev to 0 if the close method | ||
479 | has been called */ | ||
480 | port->interrupt_in_urb->dev = port->serial->dev; | ||
481 | |||
482 | /* start reading (except TWIN and KAAN SIM) */ | 461 | /* start reading (except TWIN and KAAN SIM) */ |
483 | if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || | 462 | if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || |
484 | priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) { | 463 | priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) { |
485 | /* someone sets the dev to 0 if the close method has | ||
486 | been called */ | ||
487 | port->interrupt_in_urb->dev = port->serial->dev; | ||
488 | |||
489 | result = usb_submit_urb(port->interrupt_in_urb, | 464 | result = usb_submit_urb(port->interrupt_in_urb, |
490 | GFP_NOIO); | 465 | GFP_NOIO); |
491 | dbg("%s - port %d Send read URB returns: %i", | 466 | dbg("%s - port %d Send read URB returns: %i", |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index ba0d28727ccb..a975bb80303f 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -19,50 +19,6 @@ | |||
19 | * DTR/RTS signal handling may be incomplete or incorrect. I have mainly | 19 | * DTR/RTS signal handling may be incomplete or incorrect. I have mainly |
20 | * implemented what I have seen with SniffUSB or found in belkin_sa.c. | 20 | * implemented what I have seen with SniffUSB or found in belkin_sa.c. |
21 | * For further TODOs check also belkin_sa.c. | 21 | * For further TODOs check also belkin_sa.c. |
22 | * | ||
23 | * TEST STATUS: | ||
24 | * Basic tests have been performed with minicom/zmodem transfers and | ||
25 | * modem dialing under Linux 2.4.0-test10 (for me it works fine). | ||
26 | * | ||
27 | * 04-Nov-2003 Bill Marr <marr at flex dot com> | ||
28 | * - Mimic Windows driver by sending 2 USB 'device request' messages | ||
29 | * following normal 'baud rate change' message. This allows data to be | ||
30 | * transmitted to RS-232 devices which don't assert the 'CTS' signal. | ||
31 | * | ||
32 | * 10-Nov-2001 Wolfgang Grandegger | ||
33 | * - Fixed an endianess problem with the baudrate selection for PowerPC. | ||
34 | * | ||
35 | * 06-Dec-2001 Martin Hamilton <martinh@gnu.org> | ||
36 | * - Added support for the Belkin F5U109 DB9 adaptor | ||
37 | * | ||
38 | * 30-May-2001 Greg Kroah-Hartman | ||
39 | * - switched from using spinlock to a semaphore, which fixes lots of | ||
40 | * problems. | ||
41 | * | ||
42 | * 04-May-2001 Stelian Pop | ||
43 | * - Set the maximum bulk output size for Sitecom U232-P25 model to 16 bytes | ||
44 | * instead of the device reported 32 (using 32 bytes causes many data | ||
45 | * loss, Windows driver uses 16 too). | ||
46 | * | ||
47 | * 02-May-2001 Stelian Pop | ||
48 | * - Fixed the baud calculation for Sitecom U232-P25 model | ||
49 | * | ||
50 | * 08-Apr-2001 gb | ||
51 | * - Identify version on module load. | ||
52 | * | ||
53 | * 06-Jan-2001 Cornel Ciocirlan | ||
54 | * - Added support for Sitecom U232-P25 model (Product Id 0x0230) | ||
55 | * - Added support for D-Link DU-H3SP USB BAY (Product Id 0x0200) | ||
56 | * | ||
57 | * 29-Nov-2000 Greg Kroah-Hartman | ||
58 | * - Added device id table to fit with 2.4.0-test11 structure. | ||
59 | * - took out DEAL_WITH_TWO_INT_IN_ENDPOINTS #define as it's not needed | ||
60 | * (lots of things will change if/when the usb-serial core changes to | ||
61 | * handle these issues. | ||
62 | * | ||
63 | * 27-Nov-2000 Wolfgang Grandegge | ||
64 | * A version for kernel 2.4.0-test10 released to the Linux community | ||
65 | * (via linux-usb-devel). | ||
66 | */ | 22 | */ |
67 | 23 | ||
68 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
@@ -526,7 +482,6 @@ static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
526 | mct_u232_msr_to_state(&priv->control_state, priv->last_msr); | 482 | mct_u232_msr_to_state(&priv->control_state, priv->last_msr); |
527 | spin_unlock_irqrestore(&priv->lock, flags); | 483 | spin_unlock_irqrestore(&priv->lock, flags); |
528 | 484 | ||
529 | port->read_urb->dev = port->serial->dev; | ||
530 | retval = usb_submit_urb(port->read_urb, GFP_KERNEL); | 485 | retval = usb_submit_urb(port->read_urb, GFP_KERNEL); |
531 | if (retval) { | 486 | if (retval) { |
532 | dev_err(&port->dev, | 487 | dev_err(&port->dev, |
@@ -535,7 +490,6 @@ static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
535 | goto error; | 490 | goto error; |
536 | } | 491 | } |
537 | 492 | ||
538 | port->interrupt_in_urb->dev = port->serial->dev; | ||
539 | retval = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 493 | retval = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
540 | if (retval) { | 494 | if (retval) { |
541 | usb_kill_urb(port->read_urb); | 495 | usb_kill_urb(port->read_urb); |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 3524a105d042..19d112f51b97 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -939,14 +939,7 @@ static void mos7720_bulk_in_callback(struct urb *urb) | |||
939 | } | 939 | } |
940 | tty_kref_put(tty); | 940 | tty_kref_put(tty); |
941 | 941 | ||
942 | if (!port->read_urb) { | ||
943 | dbg("URB KILLED !!!"); | ||
944 | return; | ||
945 | } | ||
946 | |||
947 | if (port->read_urb->status != -EINPROGRESS) { | 942 | if (port->read_urb->status != -EINPROGRESS) { |
948 | port->read_urb->dev = port->serial->dev; | ||
949 | |||
950 | retval = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 943 | retval = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
951 | if (retval) | 944 | if (retval) |
952 | dbg("usb_submit_urb(read bulk) failed, retval = %d", | 945 | dbg("usb_submit_urb(read bulk) failed, retval = %d", |
@@ -1014,7 +1007,6 @@ static int mos77xx_calc_num_ports(struct usb_serial *serial) | |||
1014 | static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port) | 1007 | static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port) |
1015 | { | 1008 | { |
1016 | struct usb_serial *serial; | 1009 | struct usb_serial *serial; |
1017 | struct usb_serial_port *port0; | ||
1018 | struct urb *urb; | 1010 | struct urb *urb; |
1019 | struct moschip_port *mos7720_port; | 1011 | struct moschip_port *mos7720_port; |
1020 | int response; | 1012 | int response; |
@@ -1029,8 +1021,6 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1029 | if (mos7720_port == NULL) | 1021 | if (mos7720_port == NULL) |
1030 | return -ENODEV; | 1022 | return -ENODEV; |
1031 | 1023 | ||
1032 | port0 = serial->port[0]; | ||
1033 | |||
1034 | usb_clear_halt(serial->dev, port->write_urb->pipe); | 1024 | usb_clear_halt(serial->dev, port->write_urb->pipe); |
1035 | usb_clear_halt(serial->dev, port->read_urb->pipe); | 1025 | usb_clear_halt(serial->dev, port->read_urb->pipe); |
1036 | 1026 | ||
@@ -1735,8 +1725,6 @@ static void change_port_settings(struct tty_struct *tty, | |||
1735 | write_mos_reg(serial, port_number, IER, 0x0c); | 1725 | write_mos_reg(serial, port_number, IER, 0x0c); |
1736 | 1726 | ||
1737 | if (port->read_urb->status != -EINPROGRESS) { | 1727 | if (port->read_urb->status != -EINPROGRESS) { |
1738 | port->read_urb->dev = serial->dev; | ||
1739 | |||
1740 | status = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 1728 | status = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
1741 | if (status) | 1729 | if (status) |
1742 | dbg("usb_submit_urb(read bulk) failed, status = %d", | 1730 | dbg("usb_submit_urb(read bulk) failed, status = %d", |
@@ -1786,13 +1774,7 @@ static void mos7720_set_termios(struct tty_struct *tty, | |||
1786 | /* change the port settings to the new ones specified */ | 1774 | /* change the port settings to the new ones specified */ |
1787 | change_port_settings(tty, mos7720_port, old_termios); | 1775 | change_port_settings(tty, mos7720_port, old_termios); |
1788 | 1776 | ||
1789 | if (!port->read_urb) { | ||
1790 | dbg("%s", "URB KILLED !!!!!"); | ||
1791 | return; | ||
1792 | } | ||
1793 | |||
1794 | if (port->read_urb->status != -EINPROGRESS) { | 1777 | if (port->read_urb->status != -EINPROGRESS) { |
1795 | port->read_urb->dev = serial->dev; | ||
1796 | status = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 1778 | status = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
1797 | if (status) | 1779 | if (status) |
1798 | dbg("usb_submit_urb(read bulk) failed, status = %d", | 1780 | dbg("usb_submit_urb(read bulk) failed, status = %d", |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index c72abd524983..55cfd6265b98 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -792,8 +792,6 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
792 | } | 792 | } |
793 | 793 | ||
794 | 794 | ||
795 | mos7840_port->read_urb->dev = serial->dev; | ||
796 | |||
797 | mos7840_port->read_urb_busy = true; | 795 | mos7840_port->read_urb_busy = true; |
798 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 796 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
799 | 797 | ||
@@ -2058,7 +2056,6 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
2058 | mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); | 2056 | mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); |
2059 | 2057 | ||
2060 | if (mos7840_port->read_urb_busy == false) { | 2058 | if (mos7840_port->read_urb_busy == false) { |
2061 | mos7840_port->read_urb->dev = serial->dev; | ||
2062 | mos7840_port->read_urb_busy = true; | 2059 | mos7840_port->read_urb_busy = true; |
2063 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 2060 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
2064 | if (status) { | 2061 | if (status) { |
@@ -2130,7 +2127,6 @@ static void mos7840_set_termios(struct tty_struct *tty, | |||
2130 | } | 2127 | } |
2131 | 2128 | ||
2132 | if (mos7840_port->read_urb_busy == false) { | 2129 | if (mos7840_port->read_urb_busy == false) { |
2133 | mos7840_port->read_urb->dev = serial->dev; | ||
2134 | mos7840_port->read_urb_busy = true; | 2130 | mos7840_port->read_urb_busy = true; |
2135 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 2131 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
2136 | if (status) { | 2132 | if (status) { |
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 60f38d5e64fc..45a8c55881d3 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -9,31 +9,6 @@ | |||
9 | * driver | 9 | * driver |
10 | * | 10 | * |
11 | * Please report both successes and troubles to the author at omninet@kroah.com | 11 | * Please report both successes and troubles to the author at omninet@kroah.com |
12 | * | ||
13 | * (05/30/2001) gkh | ||
14 | * switched from using spinlock to a semaphore, which fixes lots of | ||
15 | * problems. | ||
16 | * | ||
17 | * (04/08/2001) gb | ||
18 | * Identify version on module load. | ||
19 | * | ||
20 | * (11/01/2000) Adam J. Richter | ||
21 | * usb_device_id table support | ||
22 | * | ||
23 | * (10/05/2000) gkh | ||
24 | * Fixed bug with urb->dev not being set properly, now that the usb | ||
25 | * core needs it. | ||
26 | * | ||
27 | * (08/28/2000) gkh | ||
28 | * Added locks for SMP safeness. | ||
29 | * Fixed MOD_INC and MOD_DEC logic and the ability to open a port more | ||
30 | * than once. | ||
31 | * Fixed potential race in omninet_write_bulk_callback | ||
32 | * | ||
33 | * (07/19/2000) gkh | ||
34 | * Added module_init and module_exit functions to handle the fact that this | ||
35 | * driver is a loadable module now. | ||
36 | * | ||
37 | */ | 12 | */ |
38 | 13 | ||
39 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
@@ -44,7 +19,6 @@ | |||
44 | #include <linux/tty_driver.h> | 19 | #include <linux/tty_driver.h> |
45 | #include <linux/tty_flip.h> | 20 | #include <linux/tty_flip.h> |
46 | #include <linux/module.h> | 21 | #include <linux/module.h> |
47 | #include <linux/spinlock.h> | ||
48 | #include <linux/uaccess.h> | 22 | #include <linux/uaccess.h> |
49 | #include <linux/usb.h> | 23 | #include <linux/usb.h> |
50 | #include <linux/usb/serial.h> | 24 | #include <linux/usb/serial.h> |
@@ -174,12 +148,6 @@ static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
174 | tty_port_tty_set(&wport->port, tty); | 148 | tty_port_tty_set(&wport->port, tty); |
175 | 149 | ||
176 | /* Start reading from the device */ | 150 | /* Start reading from the device */ |
177 | usb_fill_bulk_urb(port->read_urb, serial->dev, | ||
178 | usb_rcvbulkpipe(serial->dev, | ||
179 | port->bulk_in_endpointAddress), | ||
180 | port->read_urb->transfer_buffer, | ||
181 | port->read_urb->transfer_buffer_length, | ||
182 | omninet_read_bulk_callback, port); | ||
183 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | 151 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); |
184 | if (result) | 152 | if (result) |
185 | dev_err(&port->dev, | 153 | dev_err(&port->dev, |
@@ -236,11 +204,6 @@ static void omninet_read_bulk_callback(struct urb *urb) | |||
236 | } | 204 | } |
237 | 205 | ||
238 | /* Continue trying to always read */ | 206 | /* Continue trying to always read */ |
239 | usb_fill_bulk_urb(urb, port->serial->dev, | ||
240 | usb_rcvbulkpipe(port->serial->dev, | ||
241 | port->bulk_in_endpointAddress), | ||
242 | urb->transfer_buffer, urb->transfer_buffer_length, | ||
243 | omninet_read_bulk_callback, port); | ||
244 | result = usb_submit_urb(urb, GFP_ATOMIC); | 207 | result = usb_submit_urb(urb, GFP_ATOMIC); |
245 | if (result) | 208 | if (result) |
246 | dev_err(&port->dev, | 209 | dev_err(&port->dev, |
@@ -267,14 +230,10 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
267 | return 0; | 230 | return 0; |
268 | } | 231 | } |
269 | 232 | ||
270 | spin_lock_bh(&wport->lock); | 233 | if (!test_and_clear_bit(0, &port->write_urbs_free)) { |
271 | if (wport->write_urb_busy) { | ||
272 | spin_unlock_bh(&wport->lock); | ||
273 | dbg("%s - already writing", __func__); | 234 | dbg("%s - already writing", __func__); |
274 | return 0; | 235 | return 0; |
275 | } | 236 | } |
276 | wport->write_urb_busy = 1; | ||
277 | spin_unlock_bh(&wport->lock); | ||
278 | 237 | ||
279 | count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count; | 238 | count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count; |
280 | 239 | ||
@@ -292,10 +251,9 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
292 | /* send the data out the bulk port, always 64 bytes */ | 251 | /* send the data out the bulk port, always 64 bytes */ |
293 | wport->write_urb->transfer_buffer_length = 64; | 252 | wport->write_urb->transfer_buffer_length = 64; |
294 | 253 | ||
295 | wport->write_urb->dev = serial->dev; | ||
296 | result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); | 254 | result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); |
297 | if (result) { | 255 | if (result) { |
298 | wport->write_urb_busy = 0; | 256 | set_bit(0, &wport->write_urbs_free); |
299 | dev_err(&port->dev, | 257 | dev_err(&port->dev, |
300 | "%s - failed submitting write urb, error %d\n", | 258 | "%s - failed submitting write urb, error %d\n", |
301 | __func__, result); | 259 | __func__, result); |
@@ -314,8 +272,7 @@ static int omninet_write_room(struct tty_struct *tty) | |||
314 | 272 | ||
315 | int room = 0; /* Default: no room */ | 273 | int room = 0; /* Default: no room */ |
316 | 274 | ||
317 | /* FIXME: no consistent locking for write_urb_busy */ | 275 | if (test_bit(0, &wport->write_urbs_free)) |
318 | if (wport->write_urb_busy) | ||
319 | room = wport->bulk_out_size - OMNINET_HEADERLEN; | 276 | room = wport->bulk_out_size - OMNINET_HEADERLEN; |
320 | 277 | ||
321 | dbg("%s - returns %d", __func__, room); | 278 | dbg("%s - returns %d", __func__, room); |
@@ -332,7 +289,7 @@ static void omninet_write_bulk_callback(struct urb *urb) | |||
332 | 289 | ||
333 | dbg("%s - port %0x", __func__, port->number); | 290 | dbg("%s - port %0x", __func__, port->number); |
334 | 291 | ||
335 | port->write_urb_busy = 0; | 292 | set_bit(0, &port->write_urbs_free); |
336 | if (status) { | 293 | if (status) { |
337 | dbg("%s - nonzero write bulk status received: %d", | 294 | dbg("%s - nonzero write bulk status received: %d", |
338 | __func__, status); | 295 | __func__, status); |
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index c248a9147439..691f57a9d712 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c | |||
@@ -384,7 +384,6 @@ static void opticon_unthrottle(struct tty_struct *tty) | |||
384 | priv->actually_throttled = false; | 384 | priv->actually_throttled = false; |
385 | spin_unlock_irqrestore(&priv->lock, flags); | 385 | spin_unlock_irqrestore(&priv->lock, flags); |
386 | 386 | ||
387 | priv->bulk_read_urb->dev = port->serial->dev; | ||
388 | if (was_throttled) { | 387 | if (was_throttled) { |
389 | result = usb_submit_urb(priv->bulk_read_urb, GFP_ATOMIC); | 388 | result = usb_submit_urb(priv->bulk_read_urb, GFP_ATOMIC); |
390 | if (result) | 389 | if (result) |
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index 4c29e6c2bda7..2161d1c3c089 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
@@ -264,7 +264,6 @@ static void setup_line(struct work_struct *work) | |||
264 | spin_unlock_irqrestore(&priv->lock, flags); | 264 | spin_unlock_irqrestore(&priv->lock, flags); |
265 | 265 | ||
266 | dbg("%s(): submitting interrupt urb", __func__); | 266 | dbg("%s(): submitting interrupt urb", __func__); |
267 | port->interrupt_in_urb->dev = port->serial->dev; | ||
268 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 267 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
269 | if (result != 0) { | 268 | if (result != 0) { |
270 | dev_err(&port->dev, "%s(): usb_submit_urb() failed" | 269 | dev_err(&port->dev, "%s(): usb_submit_urb() failed" |
@@ -321,7 +320,6 @@ static void send_data(struct work_struct *work) | |||
321 | priv->flags.write_urb_in_use = 0; | 320 | priv->flags.write_urb_in_use = 0; |
322 | 321 | ||
323 | dbg("%s(): submitting interrupt urb", __func__); | 322 | dbg("%s(): submitting interrupt urb", __func__); |
324 | port->interrupt_in_urb->dev = port->serial->dev; | ||
325 | result = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); | 323 | result = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); |
326 | if (result != 0) { | 324 | if (result != 0) { |
327 | dev_err(&port->dev, "%s(): usb_submit_urb() failed" | 325 | dev_err(&port->dev, "%s(): usb_submit_urb() failed" |
@@ -334,7 +332,6 @@ static void send_data(struct work_struct *work) | |||
334 | port->write_urb->transfer_buffer, | 332 | port->write_urb->transfer_buffer, |
335 | count, &port->lock); | 333 | count, &port->lock); |
336 | port->write_urb->transfer_buffer_length = count; | 334 | port->write_urb->transfer_buffer_length = count; |
337 | port->write_urb->dev = port->serial->dev; | ||
338 | result = usb_submit_urb(port->write_urb, GFP_NOIO); | 335 | result = usb_submit_urb(port->write_urb, GFP_NOIO); |
339 | if (result != 0) { | 336 | if (result != 0) { |
340 | dev_err(&port->dev, "%s(): usb_submit_urb() failed" | 337 | dev_err(&port->dev, "%s(): usb_submit_urb() failed" |
@@ -583,13 +580,12 @@ static int oti6858_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
583 | kfree(buf); | 580 | kfree(buf); |
584 | 581 | ||
585 | dbg("%s(): submitting interrupt urb", __func__); | 582 | dbg("%s(): submitting interrupt urb", __func__); |
586 | port->interrupt_in_urb->dev = serial->dev; | ||
587 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 583 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
588 | if (result != 0) { | 584 | if (result != 0) { |
589 | dev_err(&port->dev, "%s(): usb_submit_urb() failed" | 585 | dev_err(&port->dev, "%s(): usb_submit_urb() failed" |
590 | " with error %d\n", __func__, result); | 586 | " with error %d\n", __func__, result); |
591 | oti6858_close(port); | 587 | oti6858_close(port); |
592 | return -EPROTO; | 588 | return result; |
593 | } | 589 | } |
594 | 590 | ||
595 | /* setup termios */ | 591 | /* setup termios */ |
@@ -837,7 +833,6 @@ static void oti6858_read_int_callback(struct urb *urb) | |||
837 | if (can_recv) { | 833 | if (can_recv) { |
838 | int result; | 834 | int result; |
839 | 835 | ||
840 | port->read_urb->dev = port->serial->dev; | ||
841 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 836 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
842 | if (result != 0) { | 837 | if (result != 0) { |
843 | priv->flags.read_urb_in_use = 0; | 838 | priv->flags.read_urb_in_use = 0; |
@@ -866,7 +861,6 @@ static void oti6858_read_int_callback(struct urb *urb) | |||
866 | int result; | 861 | int result; |
867 | 862 | ||
868 | /* dbg("%s(): submitting interrupt urb", __func__); */ | 863 | /* dbg("%s(): submitting interrupt urb", __func__); */ |
869 | urb->dev = port->serial->dev; | ||
870 | result = usb_submit_urb(urb, GFP_ATOMIC); | 864 | result = usb_submit_urb(urb, GFP_ATOMIC); |
871 | if (result != 0) { | 865 | if (result != 0) { |
872 | dev_err(&urb->dev->dev, | 866 | dev_err(&urb->dev->dev, |
@@ -894,18 +888,6 @@ static void oti6858_read_bulk_callback(struct urb *urb) | |||
894 | spin_unlock_irqrestore(&priv->lock, flags); | 888 | spin_unlock_irqrestore(&priv->lock, flags); |
895 | 889 | ||
896 | if (status != 0) { | 890 | if (status != 0) { |
897 | /* | ||
898 | if (status == -EPROTO) { | ||
899 | * PL2303 mysteriously fails with -EPROTO reschedule | ||
900 | the read * | ||
901 | dbg("%s - caught -EPROTO, resubmitting the urb", | ||
902 | __func__); | ||
903 | result = usb_submit_urb(urb, GFP_ATOMIC); | ||
904 | if (result) | ||
905 | dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __func__, result); | ||
906 | return; | ||
907 | } | ||
908 | */ | ||
909 | dbg("%s(): unable to handle the error, exiting", __func__); | 891 | dbg("%s(): unable to handle the error, exiting", __func__); |
910 | return; | 892 | return; |
911 | } | 893 | } |
@@ -918,7 +900,6 @@ static void oti6858_read_bulk_callback(struct urb *urb) | |||
918 | tty_kref_put(tty); | 900 | tty_kref_put(tty); |
919 | 901 | ||
920 | /* schedule the interrupt urb */ | 902 | /* schedule the interrupt urb */ |
921 | port->interrupt_in_urb->dev = port->serial->dev; | ||
922 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); | 903 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); |
923 | if (result != 0 && result != -EPERM) { | 904 | if (result != 0 && result != -EPERM) { |
924 | dev_err(&port->dev, "%s(): usb_submit_urb() failed," | 905 | dev_err(&port->dev, "%s(): usb_submit_urb() failed," |
@@ -955,7 +936,6 @@ static void oti6858_write_bulk_callback(struct urb *urb) | |||
955 | dbg("%s(): overflow in write", __func__); | 936 | dbg("%s(): overflow in write", __func__); |
956 | 937 | ||
957 | port->write_urb->transfer_buffer_length = 1; | 938 | port->write_urb->transfer_buffer_length = 1; |
958 | port->write_urb->dev = port->serial->dev; | ||
959 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 939 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
960 | if (result) { | 940 | if (result) { |
961 | dev_err(&port->dev, "%s(): usb_submit_urb() failed," | 941 | dev_err(&port->dev, "%s(): usb_submit_urb() failed," |
@@ -968,7 +948,6 @@ static void oti6858_write_bulk_callback(struct urb *urb) | |||
968 | priv->flags.write_urb_in_use = 0; | 948 | priv->flags.write_urb_in_use = 0; |
969 | 949 | ||
970 | /* schedule the interrupt urb if we are still open */ | 950 | /* schedule the interrupt urb if we are still open */ |
971 | port->interrupt_in_urb->dev = port->serial->dev; | ||
972 | dbg("%s(): submitting interrupt urb", __func__); | 951 | dbg("%s(): submitting interrupt urb", __func__); |
973 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); | 952 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); |
974 | if (result != 0) { | 953 | if (result != 0) { |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index fc2d66f7f4eb..329295615d06 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -502,21 +502,20 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
502 | if (tty) | 502 | if (tty) |
503 | pl2303_set_termios(tty, port, &tmp_termios); | 503 | pl2303_set_termios(tty, port, &tmp_termios); |
504 | 504 | ||
505 | dbg("%s - submitting read urb", __func__); | ||
506 | result = usb_serial_generic_submit_read_urb(port, GFP_KERNEL); | ||
507 | if (result) { | ||
508 | pl2303_close(port); | ||
509 | return -EPROTO; | ||
510 | } | ||
511 | |||
512 | dbg("%s - submitting interrupt urb", __func__); | 505 | dbg("%s - submitting interrupt urb", __func__); |
513 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 506 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
514 | if (result) { | 507 | if (result) { |
515 | dev_err(&port->dev, "%s - failed submitting interrupt urb," | 508 | dev_err(&port->dev, "%s - failed submitting interrupt urb," |
516 | " error %d\n", __func__, result); | 509 | " error %d\n", __func__, result); |
517 | pl2303_close(port); | 510 | return result; |
518 | return -EPROTO; | ||
519 | } | 511 | } |
512 | |||
513 | result = usb_serial_generic_open(tty, port); | ||
514 | if (result) { | ||
515 | usb_kill_urb(port->interrupt_in_urb); | ||
516 | return result; | ||
517 | } | ||
518 | |||
520 | port->port.drain_delay = 256; | 519 | port->port.drain_delay = 256; |
521 | return 0; | 520 | return 0; |
522 | } | 521 | } |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index b18179bda0d8..f2485429172f 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -681,7 +681,6 @@ static void sierra_instat_callback(struct urb *urb) | |||
681 | /* Resubmit urb so we continue receiving IRQ data */ | 681 | /* Resubmit urb so we continue receiving IRQ data */ |
682 | if (status != -ESHUTDOWN && status != -ENOENT) { | 682 | if (status != -ESHUTDOWN && status != -ENOENT) { |
683 | usb_mark_last_busy(serial->dev); | 683 | usb_mark_last_busy(serial->dev); |
684 | urb->dev = serial->dev; | ||
685 | err = usb_submit_urb(urb, GFP_ATOMIC); | 684 | err = usb_submit_urb(urb, GFP_ATOMIC); |
686 | if (err && err != -EPERM) | 685 | if (err && err != -EPERM) |
687 | dev_err(&port->dev, "%s: resubmit intr urb " | 686 | dev_err(&port->dev, "%s: resubmit intr urb " |
diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c index 7096f799b071..c70cc012d03f 100644 --- a/drivers/usb/serial/symbolserial.c +++ b/drivers/usb/serial/symbolserial.c | |||
@@ -182,7 +182,6 @@ static void symbol_unthrottle(struct tty_struct *tty) | |||
182 | priv->actually_throttled = false; | 182 | priv->actually_throttled = false; |
183 | spin_unlock_irq(&priv->lock); | 183 | spin_unlock_irq(&priv->lock); |
184 | 184 | ||
185 | priv->int_urb->dev = port->serial->dev; | ||
186 | if (was_throttled) { | 185 | if (was_throttled) { |
187 | result = usb_submit_urb(priv->int_urb, GFP_KERNEL); | 186 | result = usb_submit_urb(priv->int_urb, GFP_KERNEL); |
188 | if (result) | 187 | if (result) |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index ea8445689c85..4af21f46096e 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -535,9 +535,7 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
535 | status = -EINVAL; | 535 | status = -EINVAL; |
536 | goto release_lock; | 536 | goto release_lock; |
537 | } | 537 | } |
538 | urb->complete = ti_interrupt_callback; | ||
539 | urb->context = tdev; | 538 | urb->context = tdev; |
540 | urb->dev = dev; | ||
541 | status = usb_submit_urb(urb, GFP_KERNEL); | 539 | status = usb_submit_urb(urb, GFP_KERNEL); |
542 | if (status) { | 540 | if (status) { |
543 | dev_err(&port->dev, | 541 | dev_err(&port->dev, |
@@ -619,9 +617,7 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
619 | goto unlink_int_urb; | 617 | goto unlink_int_urb; |
620 | } | 618 | } |
621 | tport->tp_read_urb_state = TI_READ_URB_RUNNING; | 619 | tport->tp_read_urb_state = TI_READ_URB_RUNNING; |
622 | urb->complete = ti_bulk_in_callback; | ||
623 | urb->context = tport; | 620 | urb->context = tport; |
624 | urb->dev = dev; | ||
625 | status = usb_submit_urb(urb, GFP_KERNEL); | 621 | status = usb_submit_urb(urb, GFP_KERNEL); |
626 | if (status) { | 622 | if (status) { |
627 | dev_err(&port->dev, "%s - submit read urb failed, %d\n", | 623 | dev_err(&port->dev, "%s - submit read urb failed, %d\n", |
@@ -1236,12 +1232,11 @@ static void ti_bulk_in_callback(struct urb *urb) | |||
1236 | exit: | 1232 | exit: |
1237 | /* continue to read unless stopping */ | 1233 | /* continue to read unless stopping */ |
1238 | spin_lock(&tport->tp_lock); | 1234 | spin_lock(&tport->tp_lock); |
1239 | if (tport->tp_read_urb_state == TI_READ_URB_RUNNING) { | 1235 | if (tport->tp_read_urb_state == TI_READ_URB_RUNNING) |
1240 | urb->dev = port->serial->dev; | ||
1241 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 1236 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
1242 | } else if (tport->tp_read_urb_state == TI_READ_URB_STOPPING) { | 1237 | else if (tport->tp_read_urb_state == TI_READ_URB_STOPPING) |
1243 | tport->tp_read_urb_state = TI_READ_URB_STOPPED; | 1238 | tport->tp_read_urb_state = TI_READ_URB_STOPPED; |
1244 | } | 1239 | |
1245 | spin_unlock(&tport->tp_lock); | 1240 | spin_unlock(&tport->tp_lock); |
1246 | if (retval) | 1241 | if (retval) |
1247 | dev_err(dev, "%s - resubmit read urb failed, %d\n", | 1242 | dev_err(dev, "%s - resubmit read urb failed, %d\n", |
@@ -1574,9 +1569,7 @@ static int ti_restart_read(struct ti_port *tport, struct tty_struct *tty) | |||
1574 | tport->tp_read_urb_state = TI_READ_URB_RUNNING; | 1569 | tport->tp_read_urb_state = TI_READ_URB_RUNNING; |
1575 | urb = tport->tp_port->read_urb; | 1570 | urb = tport->tp_port->read_urb; |
1576 | spin_unlock_irqrestore(&tport->tp_lock, flags); | 1571 | spin_unlock_irqrestore(&tport->tp_lock, flags); |
1577 | urb->complete = ti_bulk_in_callback; | ||
1578 | urb->context = tport; | 1572 | urb->context = tport; |
1579 | urb->dev = tport->tp_port->serial->dev; | ||
1580 | status = usb_submit_urb(urb, GFP_KERNEL); | 1573 | status = usb_submit_urb(urb, GFP_KERNEL); |
1581 | } else { | 1574 | } else { |
1582 | tport->tp_read_urb_state = TI_READ_URB_RUNNING; | 1575 | tport->tp_read_urb_state = TI_READ_URB_RUNNING; |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index cc274fdf2627..ce6c1a65a544 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -50,7 +50,7 @@ static struct usb_driver usb_serial_driver = { | |||
50 | .disconnect = usb_serial_disconnect, | 50 | .disconnect = usb_serial_disconnect, |
51 | .suspend = usb_serial_suspend, | 51 | .suspend = usb_serial_suspend, |
52 | .resume = usb_serial_resume, | 52 | .resume = usb_serial_resume, |
53 | .no_dynamic_id = 1, | 53 | .no_dynamic_id = 1, |
54 | .supports_autosuspend = 1, | 54 | .supports_autosuspend = 1, |
55 | }; | 55 | }; |
56 | 56 | ||
@@ -260,6 +260,10 @@ static int serial_activate(struct tty_port *tport, struct tty_struct *tty) | |||
260 | else | 260 | else |
261 | retval = port->serial->type->open(tty, port); | 261 | retval = port->serial->type->open(tty, port); |
262 | mutex_unlock(&serial->disc_mutex); | 262 | mutex_unlock(&serial->disc_mutex); |
263 | |||
264 | if (retval < 0) | ||
265 | retval = usb_translate_errors(retval); | ||
266 | |||
263 | return retval; | 267 | return retval; |
264 | } | 268 | } |
265 | 269 | ||
@@ -360,7 +364,8 @@ static int serial_write(struct tty_struct *tty, const unsigned char *buf, | |||
360 | 364 | ||
361 | /* pass on to the driver specific version of this function */ | 365 | /* pass on to the driver specific version of this function */ |
362 | retval = port->serial->type->write(tty, port, buf, count); | 366 | retval = port->serial->type->write(tty, port, buf, count); |
363 | 367 | if (retval < 0) | |
368 | retval = usb_translate_errors(retval); | ||
364 | exit: | 369 | exit: |
365 | return retval; | 370 | return retval; |
366 | } | 371 | } |
@@ -562,8 +567,8 @@ static void kill_traffic(struct usb_serial_port *port) | |||
562 | { | 567 | { |
563 | int i; | 568 | int i; |
564 | 569 | ||
565 | usb_kill_urb(port->read_urb); | 570 | for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) |
566 | usb_kill_urb(port->write_urb); | 571 | usb_kill_urb(port->read_urbs[i]); |
567 | for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) | 572 | for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) |
568 | usb_kill_urb(port->write_urbs[i]); | 573 | usb_kill_urb(port->write_urbs[i]); |
569 | /* | 574 | /* |
@@ -595,17 +600,17 @@ static void port_release(struct device *dev) | |||
595 | kill_traffic(port); | 600 | kill_traffic(port); |
596 | cancel_work_sync(&port->work); | 601 | cancel_work_sync(&port->work); |
597 | 602 | ||
598 | usb_free_urb(port->read_urb); | ||
599 | usb_free_urb(port->write_urb); | ||
600 | usb_free_urb(port->interrupt_in_urb); | 603 | usb_free_urb(port->interrupt_in_urb); |
601 | usb_free_urb(port->interrupt_out_urb); | 604 | usb_free_urb(port->interrupt_out_urb); |
605 | for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) { | ||
606 | usb_free_urb(port->read_urbs[i]); | ||
607 | kfree(port->bulk_in_buffers[i]); | ||
608 | } | ||
602 | for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) { | 609 | for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) { |
603 | usb_free_urb(port->write_urbs[i]); | 610 | usb_free_urb(port->write_urbs[i]); |
604 | kfree(port->bulk_out_buffers[i]); | 611 | kfree(port->bulk_out_buffers[i]); |
605 | } | 612 | } |
606 | kfifo_free(&port->write_fifo); | 613 | kfifo_free(&port->write_fifo); |
607 | kfree(port->bulk_in_buffer); | ||
608 | kfree(port->bulk_out_buffer); | ||
609 | kfree(port->interrupt_in_buffer); | 614 | kfree(port->interrupt_in_buffer); |
610 | kfree(port->interrupt_out_buffer); | 615 | kfree(port->interrupt_out_buffer); |
611 | kfree(port); | 616 | kfree(port); |
@@ -686,16 +691,18 @@ static int serial_carrier_raised(struct tty_port *port) | |||
686 | { | 691 | { |
687 | struct usb_serial_port *p = container_of(port, struct usb_serial_port, port); | 692 | struct usb_serial_port *p = container_of(port, struct usb_serial_port, port); |
688 | struct usb_serial_driver *drv = p->serial->type; | 693 | struct usb_serial_driver *drv = p->serial->type; |
694 | |||
689 | if (drv->carrier_raised) | 695 | if (drv->carrier_raised) |
690 | return drv->carrier_raised(p); | 696 | return drv->carrier_raised(p); |
691 | /* No carrier control - don't block */ | 697 | /* No carrier control - don't block */ |
692 | return 1; | 698 | return 1; |
693 | } | 699 | } |
694 | 700 | ||
695 | static void serial_dtr_rts(struct tty_port *port, int on) | 701 | static void serial_dtr_rts(struct tty_port *port, int on) |
696 | { | 702 | { |
697 | struct usb_serial_port *p = container_of(port, struct usb_serial_port, port); | 703 | struct usb_serial_port *p = container_of(port, struct usb_serial_port, port); |
698 | struct usb_serial_driver *drv = p->serial->type; | 704 | struct usb_serial_driver *drv = p->serial->type; |
705 | |||
699 | if (drv->dtr_rts) | 706 | if (drv->dtr_rts) |
700 | drv->dtr_rts(p, on); | 707 | drv->dtr_rts(p, on); |
701 | } | 708 | } |
@@ -724,6 +731,7 @@ int usb_serial_probe(struct usb_interface *interface, | |||
724 | unsigned int minor; | 731 | unsigned int minor; |
725 | int buffer_size; | 732 | int buffer_size; |
726 | int i; | 733 | int i; |
734 | int j; | ||
727 | int num_interrupt_in = 0; | 735 | int num_interrupt_in = 0; |
728 | int num_interrupt_out = 0; | 736 | int num_interrupt_out = 0; |
729 | int num_bulk_in = 0; | 737 | int num_bulk_in = 0; |
@@ -906,38 +914,41 @@ int usb_serial_probe(struct usb_interface *interface, | |||
906 | for (i = 0; i < num_bulk_in; ++i) { | 914 | for (i = 0; i < num_bulk_in; ++i) { |
907 | endpoint = bulk_in_endpoint[i]; | 915 | endpoint = bulk_in_endpoint[i]; |
908 | port = serial->port[i]; | 916 | port = serial->port[i]; |
909 | port->read_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
910 | if (!port->read_urb) { | ||
911 | dev_err(&interface->dev, "No free urbs available\n"); | ||
912 | goto probe_error; | ||
913 | } | ||
914 | buffer_size = max_t(int, serial->type->bulk_in_size, | 917 | buffer_size = max_t(int, serial->type->bulk_in_size, |
915 | usb_endpoint_maxp(endpoint)); | 918 | usb_endpoint_maxp(endpoint)); |
916 | port->bulk_in_size = buffer_size; | 919 | port->bulk_in_size = buffer_size; |
917 | port->bulk_in_endpointAddress = endpoint->bEndpointAddress; | 920 | port->bulk_in_endpointAddress = endpoint->bEndpointAddress; |
918 | port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL); | 921 | |
919 | if (!port->bulk_in_buffer) { | 922 | for (j = 0; j < ARRAY_SIZE(port->read_urbs); ++j) { |
920 | dev_err(&interface->dev, | 923 | set_bit(j, &port->read_urbs_free); |
924 | port->read_urbs[j] = usb_alloc_urb(0, GFP_KERNEL); | ||
925 | if (!port->read_urbs[j]) { | ||
926 | dev_err(&interface->dev, | ||
927 | "No free urbs available\n"); | ||
928 | goto probe_error; | ||
929 | } | ||
930 | port->bulk_in_buffers[j] = kmalloc(buffer_size, | ||
931 | GFP_KERNEL); | ||
932 | if (!port->bulk_in_buffers[j]) { | ||
933 | dev_err(&interface->dev, | ||
921 | "Couldn't allocate bulk_in_buffer\n"); | 934 | "Couldn't allocate bulk_in_buffer\n"); |
922 | goto probe_error; | 935 | goto probe_error; |
923 | } | 936 | } |
924 | usb_fill_bulk_urb(port->read_urb, dev, | 937 | usb_fill_bulk_urb(port->read_urbs[j], dev, |
925 | usb_rcvbulkpipe(dev, | 938 | usb_rcvbulkpipe(dev, |
926 | endpoint->bEndpointAddress), | 939 | endpoint->bEndpointAddress), |
927 | port->bulk_in_buffer, buffer_size, | 940 | port->bulk_in_buffers[j], buffer_size, |
928 | serial->type->read_bulk_callback, port); | 941 | serial->type->read_bulk_callback, |
942 | port); | ||
943 | } | ||
944 | |||
945 | port->read_urb = port->read_urbs[0]; | ||
946 | port->bulk_in_buffer = port->bulk_in_buffers[0]; | ||
929 | } | 947 | } |
930 | 948 | ||
931 | for (i = 0; i < num_bulk_out; ++i) { | 949 | for (i = 0; i < num_bulk_out; ++i) { |
932 | int j; | ||
933 | |||
934 | endpoint = bulk_out_endpoint[i]; | 950 | endpoint = bulk_out_endpoint[i]; |
935 | port = serial->port[i]; | 951 | port = serial->port[i]; |
936 | port->write_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
937 | if (!port->write_urb) { | ||
938 | dev_err(&interface->dev, "No free urbs available\n"); | ||
939 | goto probe_error; | ||
940 | } | ||
941 | if (kfifo_alloc(&port->write_fifo, PAGE_SIZE, GFP_KERNEL)) | 952 | if (kfifo_alloc(&port->write_fifo, PAGE_SIZE, GFP_KERNEL)) |
942 | goto probe_error; | 953 | goto probe_error; |
943 | buffer_size = serial->type->bulk_out_size; | 954 | buffer_size = serial->type->bulk_out_size; |
@@ -945,17 +956,7 @@ int usb_serial_probe(struct usb_interface *interface, | |||
945 | buffer_size = usb_endpoint_maxp(endpoint); | 956 | buffer_size = usb_endpoint_maxp(endpoint); |
946 | port->bulk_out_size = buffer_size; | 957 | port->bulk_out_size = buffer_size; |
947 | port->bulk_out_endpointAddress = endpoint->bEndpointAddress; | 958 | port->bulk_out_endpointAddress = endpoint->bEndpointAddress; |
948 | port->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL); | 959 | |
949 | if (!port->bulk_out_buffer) { | ||
950 | dev_err(&interface->dev, | ||
951 | "Couldn't allocate bulk_out_buffer\n"); | ||
952 | goto probe_error; | ||
953 | } | ||
954 | usb_fill_bulk_urb(port->write_urb, dev, | ||
955 | usb_sndbulkpipe(dev, | ||
956 | endpoint->bEndpointAddress), | ||
957 | port->bulk_out_buffer, buffer_size, | ||
958 | serial->type->write_bulk_callback, port); | ||
959 | for (j = 0; j < ARRAY_SIZE(port->write_urbs); ++j) { | 960 | for (j = 0; j < ARRAY_SIZE(port->write_urbs); ++j) { |
960 | set_bit(j, &port->write_urbs_free); | 961 | set_bit(j, &port->write_urbs_free); |
961 | port->write_urbs[j] = usb_alloc_urb(0, GFP_KERNEL); | 962 | port->write_urbs[j] = usb_alloc_urb(0, GFP_KERNEL); |
@@ -978,6 +979,9 @@ int usb_serial_probe(struct usb_interface *interface, | |||
978 | serial->type->write_bulk_callback, | 979 | serial->type->write_bulk_callback, |
979 | port); | 980 | port); |
980 | } | 981 | } |
982 | |||
983 | port->write_urb = port->write_urbs[0]; | ||
984 | port->bulk_out_buffer = port->bulk_out_buffers[0]; | ||
981 | } | 985 | } |
982 | 986 | ||
983 | if (serial->type->read_int_callback) { | 987 | if (serial->type->read_int_callback) { |
@@ -1196,7 +1200,7 @@ static const struct tty_operations serial_ops = { | |||
1196 | .open = serial_open, | 1200 | .open = serial_open, |
1197 | .close = serial_close, | 1201 | .close = serial_close, |
1198 | .write = serial_write, | 1202 | .write = serial_write, |
1199 | .hangup = serial_hangup, | 1203 | .hangup = serial_hangup, |
1200 | .write_room = serial_write_room, | 1204 | .write_room = serial_write_room, |
1201 | .ioctl = serial_ioctl, | 1205 | .ioctl = serial_ioctl, |
1202 | .set_termios = serial_set_termios, | 1206 | .set_termios = serial_set_termios, |
@@ -1206,9 +1210,9 @@ static const struct tty_operations serial_ops = { | |||
1206 | .chars_in_buffer = serial_chars_in_buffer, | 1210 | .chars_in_buffer = serial_chars_in_buffer, |
1207 | .tiocmget = serial_tiocmget, | 1211 | .tiocmget = serial_tiocmget, |
1208 | .tiocmset = serial_tiocmset, | 1212 | .tiocmset = serial_tiocmset, |
1209 | .get_icount = serial_get_icount, | 1213 | .get_icount = serial_get_icount, |
1210 | .cleanup = serial_cleanup, | 1214 | .cleanup = serial_cleanup, |
1211 | .install = serial_install, | 1215 | .install = serial_install, |
1212 | .proc_fops = &serial_proc_fops, | 1216 | .proc_fops = &serial_proc_fops, |
1213 | }; | 1217 | }; |
1214 | 1218 | ||
@@ -1237,7 +1241,7 @@ static int __init usb_serial_init(void) | |||
1237 | 1241 | ||
1238 | usb_serial_tty_driver->owner = THIS_MODULE; | 1242 | usb_serial_tty_driver->owner = THIS_MODULE; |
1239 | usb_serial_tty_driver->driver_name = "usbserial"; | 1243 | usb_serial_tty_driver->driver_name = "usbserial"; |
1240 | usb_serial_tty_driver->name = "ttyUSB"; | 1244 | usb_serial_tty_driver->name = "ttyUSB"; |
1241 | usb_serial_tty_driver->major = SERIAL_TTY_MAJOR; | 1245 | usb_serial_tty_driver->major = SERIAL_TTY_MAJOR; |
1242 | usb_serial_tty_driver->minor_start = 0; | 1246 | usb_serial_tty_driver->minor_start = 0; |
1243 | usb_serial_tty_driver->type = TTY_DRIVER_TYPE_SERIAL; | 1247 | usb_serial_tty_driver->type = TTY_DRIVER_TYPE_SERIAL; |
@@ -1336,7 +1340,6 @@ static void fixup_generic(struct usb_serial_driver *device) | |||
1336 | 1340 | ||
1337 | int usb_serial_register(struct usb_serial_driver *driver) | 1341 | int usb_serial_register(struct usb_serial_driver *driver) |
1338 | { | 1342 | { |
1339 | /* must be called with BKL held */ | ||
1340 | int retval; | 1343 | int retval; |
1341 | 1344 | ||
1342 | if (usb_disabled()) | 1345 | if (usb_disabled()) |
@@ -1374,7 +1377,6 @@ EXPORT_SYMBOL_GPL(usb_serial_register); | |||
1374 | 1377 | ||
1375 | void usb_serial_deregister(struct usb_serial_driver *device) | 1378 | void usb_serial_deregister(struct usb_serial_driver *device) |
1376 | { | 1379 | { |
1377 | /* must be called with BKL held */ | ||
1378 | printk(KERN_INFO "USB Serial deregistering driver %s\n", | 1380 | printk(KERN_INFO "USB Serial deregistering driver %s\n", |
1379 | device->description); | 1381 | device->description); |
1380 | mutex_lock(&table_lock); | 1382 | mutex_lock(&table_lock); |
diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c index 95a82148ee81..9b632e753210 100644 --- a/drivers/usb/serial/usb_debug.c +++ b/drivers/usb/serial/usb_debug.c | |||
@@ -40,7 +40,7 @@ static struct usb_driver debug_driver = { | |||
40 | .probe = usb_serial_probe, | 40 | .probe = usb_serial_probe, |
41 | .disconnect = usb_serial_disconnect, | 41 | .disconnect = usb_serial_disconnect, |
42 | .id_table = id_table, | 42 | .id_table = id_table, |
43 | .no_dynamic_id = 1, | 43 | .no_dynamic_id = 1, |
44 | }; | 44 | }; |
45 | 45 | ||
46 | /* This HW really does not support a serial break, so one will be | 46 | /* This HW really does not support a serial break, so one will be |
@@ -54,19 +54,18 @@ static void usb_debug_break_ctl(struct tty_struct *tty, int break_state) | |||
54 | usb_serial_generic_write(tty, port, USB_DEBUG_BRK, USB_DEBUG_BRK_SIZE); | 54 | usb_serial_generic_write(tty, port, USB_DEBUG_BRK, USB_DEBUG_BRK_SIZE); |
55 | } | 55 | } |
56 | 56 | ||
57 | static void usb_debug_read_bulk_callback(struct urb *urb) | 57 | static void usb_debug_process_read_urb(struct urb *urb) |
58 | { | 58 | { |
59 | struct usb_serial_port *port = urb->context; | 59 | struct usb_serial_port *port = urb->context; |
60 | 60 | ||
61 | if (urb->actual_length == USB_DEBUG_BRK_SIZE && | 61 | if (urb->actual_length == USB_DEBUG_BRK_SIZE && |
62 | memcmp(urb->transfer_buffer, USB_DEBUG_BRK, | 62 | memcmp(urb->transfer_buffer, USB_DEBUG_BRK, |
63 | USB_DEBUG_BRK_SIZE) == 0) { | 63 | USB_DEBUG_BRK_SIZE) == 0) { |
64 | usb_serial_handle_break(port); | 64 | usb_serial_handle_break(port); |
65 | usb_serial_generic_submit_read_urb(port, GFP_ATOMIC); | ||
66 | return; | 65 | return; |
67 | } | 66 | } |
68 | 67 | ||
69 | usb_serial_generic_read_bulk_callback(urb); | 68 | usb_serial_generic_process_read_urb(urb); |
70 | } | 69 | } |
71 | 70 | ||
72 | static struct usb_serial_driver debug_device = { | 71 | static struct usb_serial_driver debug_device = { |
@@ -79,7 +78,7 @@ static struct usb_serial_driver debug_device = { | |||
79 | .num_ports = 1, | 78 | .num_ports = 1, |
80 | .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, | 79 | .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, |
81 | .break_ctl = usb_debug_break_ctl, | 80 | .break_ctl = usb_debug_break_ctl, |
82 | .read_bulk_callback = usb_debug_read_bulk_callback, | 81 | .process_read_urb = usb_debug_process_read_urb, |
83 | }; | 82 | }; |
84 | 83 | ||
85 | static int __init debug_init(void) | 84 | static int __init debug_init(void) |
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 5b073bcc807b..11af903cb09f 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -14,57 +14,6 @@ | |||
14 | * | 14 | * |
15 | * See Documentation/usb/usb-serial.txt for more information on using this | 15 | * See Documentation/usb/usb-serial.txt for more information on using this |
16 | * driver | 16 | * driver |
17 | * | ||
18 | * (10/09/2002) Stuart MacDonald (stuartm@connecttech.com) | ||
19 | * Upgrade to full working driver | ||
20 | * | ||
21 | * (05/30/2001) gkh | ||
22 | * switched from using spinlock to a semaphore, which fixes lots of | ||
23 | * problems. | ||
24 | * | ||
25 | * (04/08/2001) gb | ||
26 | * Identify version on module load. | ||
27 | * | ||
28 | * 2001_Mar_19 gkh | ||
29 | * Fixed MOD_INC and MOD_DEC logic, the ability to open a port more | ||
30 | * than once, and the got the proper usb_device_id table entries so | ||
31 | * the driver works again. | ||
32 | * | ||
33 | * (11/01/2000) Adam J. Richter | ||
34 | * usb_device_id table support | ||
35 | * | ||
36 | * (10/05/2000) gkh | ||
37 | * Fixed bug with urb->dev not being set properly, now that the usb | ||
38 | * core needs it. | ||
39 | * | ||
40 | * (10/03/2000) smd | ||
41 | * firmware is improved to guard against crap sent to device | ||
42 | * firmware now replies CMD_FAILURE on bad things | ||
43 | * read_callback fix you provided for private info struct | ||
44 | * command_finished now indicates success or fail | ||
45 | * setup_port struct now packed to avoid gcc padding | ||
46 | * firmware uses 1 based port numbering, driver now handles that | ||
47 | * | ||
48 | * (09/11/2000) gkh | ||
49 | * Removed DEBUG #ifdefs with call to usb_serial_debug_data | ||
50 | * | ||
51 | * (07/19/2000) gkh | ||
52 | * Added module_init and module_exit functions to handle the fact that this | ||
53 | * driver is a loadable module now. | ||
54 | * Fixed bug with port->minor that was found by Al Borchers | ||
55 | * | ||
56 | * (07/04/2000) gkh | ||
57 | * Added support for port settings. Baud rate can now be changed. Line | ||
58 | * signals are not transferred to and from the tty layer yet, but things | ||
59 | * seem to be working well now. | ||
60 | * | ||
61 | * (05/04/2000) gkh | ||
62 | * First cut at open and close commands. Data can flow through the ports at | ||
63 | * default speeds now. | ||
64 | * | ||
65 | * (03/26/2000) gkh | ||
66 | * Split driver up into device specific pieces. | ||
67 | * | ||
68 | */ | 17 | */ |
69 | 18 | ||
70 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
@@ -753,7 +702,6 @@ static void whiteheat_close(struct usb_serial_port *port) | |||
753 | static int whiteheat_write(struct tty_struct *tty, | 702 | static int whiteheat_write(struct tty_struct *tty, |
754 | struct usb_serial_port *port, const unsigned char *buf, int count) | 703 | struct usb_serial_port *port, const unsigned char *buf, int count) |
755 | { | 704 | { |
756 | struct usb_serial *serial = port->serial; | ||
757 | struct whiteheat_private *info = usb_get_serial_port_data(port); | 705 | struct whiteheat_private *info = usb_get_serial_port_data(port); |
758 | struct whiteheat_urb_wrap *wrap; | 706 | struct whiteheat_urb_wrap *wrap; |
759 | struct urb *urb; | 707 | struct urb *urb; |
@@ -789,7 +737,6 @@ static int whiteheat_write(struct tty_struct *tty, | |||
789 | usb_serial_debug_data(debug, &port->dev, | 737 | usb_serial_debug_data(debug, &port->dev, |
790 | __func__, bytes, urb->transfer_buffer); | 738 | __func__, bytes, urb->transfer_buffer); |
791 | 739 | ||
792 | urb->dev = serial->dev; | ||
793 | urb->transfer_buffer_length = bytes; | 740 | urb->transfer_buffer_length = bytes; |
794 | result = usb_submit_urb(urb, GFP_ATOMIC); | 741 | result = usb_submit_urb(urb, GFP_ATOMIC); |
795 | if (result) { | 742 | if (result) { |
@@ -1035,7 +982,6 @@ static void command_port_read_callback(struct urb *urb) | |||
1035 | dbg("%s - bad reply from firmware", __func__); | 982 | dbg("%s - bad reply from firmware", __func__); |
1036 | 983 | ||
1037 | /* Continue trying to always read */ | 984 | /* Continue trying to always read */ |
1038 | command_port->read_urb->dev = command_port->serial->dev; | ||
1039 | result = usb_submit_urb(command_port->read_urb, GFP_ATOMIC); | 985 | result = usb_submit_urb(command_port->read_urb, GFP_ATOMIC); |
1040 | if (result) | 986 | if (result) |
1041 | dbg("%s - failed resubmitting read urb, error %d", | 987 | dbg("%s - failed resubmitting read urb, error %d", |
@@ -1141,7 +1087,6 @@ static int firm_send_command(struct usb_serial_port *port, __u8 command, | |||
1141 | transfer_buffer[0] = command; | 1087 | transfer_buffer[0] = command; |
1142 | memcpy(&transfer_buffer[1], data, datasize); | 1088 | memcpy(&transfer_buffer[1], data, datasize); |
1143 | command_port->write_urb->transfer_buffer_length = datasize + 1; | 1089 | command_port->write_urb->transfer_buffer_length = datasize + 1; |
1144 | command_port->write_urb->dev = port->serial->dev; | ||
1145 | retval = usb_submit_urb(command_port->write_urb, GFP_NOIO); | 1090 | retval = usb_submit_urb(command_port->write_urb, GFP_NOIO); |
1146 | if (retval) { | 1091 | if (retval) { |
1147 | dbg("%s - submit urb failed", __func__); | 1092 | dbg("%s - submit urb failed", __func__); |
@@ -1362,7 +1307,6 @@ static int start_command_port(struct usb_serial *serial) | |||
1362 | /* Work around HCD bugs */ | 1307 | /* Work around HCD bugs */ |
1363 | usb_clear_halt(serial->dev, command_port->read_urb->pipe); | 1308 | usb_clear_halt(serial->dev, command_port->read_urb->pipe); |
1364 | 1309 | ||
1365 | command_port->read_urb->dev = serial->dev; | ||
1366 | retval = usb_submit_urb(command_port->read_urb, GFP_KERNEL); | 1310 | retval = usb_submit_urb(command_port->read_urb, GFP_KERNEL); |
1367 | if (retval) { | 1311 | if (retval) { |
1368 | dev_err(&serial->dev->dev, | 1312 | dev_err(&serial->dev->dev, |
@@ -1410,7 +1354,6 @@ static int start_port_read(struct usb_serial_port *port) | |||
1410 | list_del(tmp); | 1354 | list_del(tmp); |
1411 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); | 1355 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); |
1412 | urb = wrap->urb; | 1356 | urb = wrap->urb; |
1413 | urb->dev = port->serial->dev; | ||
1414 | spin_unlock_irqrestore(&info->lock, flags); | 1357 | spin_unlock_irqrestore(&info->lock, flags); |
1415 | retval = usb_submit_urb(urb, GFP_KERNEL); | 1358 | retval = usb_submit_urb(urb, GFP_KERNEL); |
1416 | if (retval) { | 1359 | if (retval) { |
@@ -1490,7 +1433,6 @@ static void rx_data_softint(struct work_struct *work) | |||
1490 | sent += tty_insert_flip_string(tty, | 1433 | sent += tty_insert_flip_string(tty, |
1491 | urb->transfer_buffer, urb->actual_length); | 1434 | urb->transfer_buffer, urb->actual_length); |
1492 | 1435 | ||
1493 | urb->dev = port->serial->dev; | ||
1494 | result = usb_submit_urb(urb, GFP_ATOMIC); | 1436 | result = usb_submit_urb(urb, GFP_ATOMIC); |
1495 | if (result) { | 1437 | if (result) { |
1496 | dev_err(&port->dev, | 1438 | dev_err(&port->dev, |
diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c index 42d0eaed4a01..9ce3bbab6d20 100644 --- a/drivers/usb/storage/alauda.c +++ b/drivers/usb/storage/alauda.c | |||
@@ -139,7 +139,7 @@ static int init_alauda(struct us_data *us); | |||
139 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | 139 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ |
140 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | 140 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } |
141 | 141 | ||
142 | struct usb_device_id alauda_usb_ids[] = { | 142 | static struct usb_device_id alauda_usb_ids[] = { |
143 | # include "unusual_alauda.h" | 143 | # include "unusual_alauda.h" |
144 | { } /* Terminating entry */ | 144 | { } /* Terminating entry */ |
145 | }; | 145 | }; |
diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c index c84471821183..740bfe6b2d23 100644 --- a/drivers/usb/storage/cypress_atacb.c +++ b/drivers/usb/storage/cypress_atacb.c | |||
@@ -43,7 +43,7 @@ MODULE_LICENSE("GPL"); | |||
43 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | 43 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ |
44 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | 44 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } |
45 | 45 | ||
46 | struct usb_device_id cypress_usb_ids[] = { | 46 | static struct usb_device_id cypress_usb_ids[] = { |
47 | # include "unusual_cypress.h" | 47 | # include "unusual_cypress.h" |
48 | { } /* Terminating entry */ | 48 | { } /* Terminating entry */ |
49 | }; | 49 | }; |
diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c index ded836b02d7b..0d8d97c94f09 100644 --- a/drivers/usb/storage/datafab.c +++ b/drivers/usb/storage/datafab.c | |||
@@ -88,7 +88,7 @@ static int datafab_determine_lun(struct us_data *us, | |||
88 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | 88 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ |
89 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | 89 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } |
90 | 90 | ||
91 | struct usb_device_id datafab_usb_ids[] = { | 91 | static struct usb_device_id datafab_usb_ids[] = { |
92 | # include "unusual_datafab.h" | 92 | # include "unusual_datafab.h" |
93 | { } /* Terminating entry */ | 93 | { } /* Terminating entry */ |
94 | }; | 94 | }; |
diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c index 9fbe742343c6..b990726f144a 100644 --- a/drivers/usb/storage/ene_ub6250.c +++ b/drivers/usb/storage/ene_ub6250.c | |||
@@ -42,7 +42,7 @@ MODULE_LICENSE("GPL"); | |||
42 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | 42 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ |
43 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | 43 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } |
44 | 44 | ||
45 | struct usb_device_id ene_ub6250_usb_ids[] = { | 45 | static struct usb_device_id ene_ub6250_usb_ids[] = { |
46 | # include "unusual_ene_ub6250.h" | 46 | # include "unusual_ene_ub6250.h" |
47 | { } /* Terminating entry */ | 47 | { } /* Terminating entry */ |
48 | }; | 48 | }; |
@@ -607,8 +607,8 @@ static int sd_scsi_mode_sense(struct us_data *us, struct scsi_cmnd *srb) | |||
607 | 607 | ||
608 | static int sd_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb) | 608 | static int sd_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb) |
609 | { | 609 | { |
610 | u32 bl_num; | 610 | u32 bl_num; |
611 | u16 bl_len; | 611 | u32 bl_len; |
612 | unsigned int offset = 0; | 612 | unsigned int offset = 0; |
613 | unsigned char buf[8]; | 613 | unsigned char buf[8]; |
614 | struct scatterlist *sg = NULL; | 614 | struct scatterlist *sg = NULL; |
@@ -622,7 +622,7 @@ static int sd_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb) | |||
622 | else | 622 | else |
623 | bl_num = (info->HC_C_SIZE + 1) * 1024 - 1; | 623 | bl_num = (info->HC_C_SIZE + 1) * 1024 - 1; |
624 | } else { | 624 | } else { |
625 | bl_len = 1<<(info->SD_READ_BL_LEN); | 625 | bl_len = 1 << (info->SD_READ_BL_LEN); |
626 | bl_num = info->SD_Block_Mult * (info->SD_C_SIZE + 1) | 626 | bl_num = info->SD_Block_Mult * (info->SD_C_SIZE + 1) |
627 | * (1 << (info->SD_C_SIZE_MULT + 2)) - 1; | 627 | * (1 << (info->SD_C_SIZE_MULT + 2)) - 1; |
628 | } | 628 | } |
@@ -777,7 +777,7 @@ static int ms_lib_free_logicalmap(struct us_data *us) | |||
777 | return 0; | 777 | return 0; |
778 | } | 778 | } |
779 | 779 | ||
780 | int ms_lib_alloc_logicalmap(struct us_data *us) | 780 | static int ms_lib_alloc_logicalmap(struct us_data *us) |
781 | { | 781 | { |
782 | u32 i; | 782 | u32 i; |
783 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; | 783 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; |
@@ -2248,7 +2248,7 @@ static int sd_scsi_irp(struct us_data *us, struct scsi_cmnd *srb) | |||
2248 | /* | 2248 | /* |
2249 | * ms_scsi_irp() | 2249 | * ms_scsi_irp() |
2250 | */ | 2250 | */ |
2251 | int ms_scsi_irp(struct us_data *us, struct scsi_cmnd *srb) | 2251 | static int ms_scsi_irp(struct us_data *us, struct scsi_cmnd *srb) |
2252 | { | 2252 | { |
2253 | int result; | 2253 | int result; |
2254 | struct ene_ub6250_info *info = (struct ene_ub6250_info *)us->extra; | 2254 | struct ene_ub6250_info *info = (struct ene_ub6250_info *)us->extra; |
diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c index 6542ca40d505..8cf16f89c96c 100644 --- a/drivers/usb/storage/freecom.c +++ b/drivers/usb/storage/freecom.c | |||
@@ -119,7 +119,7 @@ static int init_freecom(struct us_data *us); | |||
119 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | 119 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ |
120 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | 120 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } |
121 | 121 | ||
122 | struct usb_device_id freecom_usb_ids[] = { | 122 | static struct usb_device_id freecom_usb_ids[] = { |
123 | # include "unusual_freecom.h" | 123 | # include "unusual_freecom.h" |
124 | { } /* Terminating entry */ | 124 | { } /* Terminating entry */ |
125 | }; | 125 | }; |
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index ffc4193e9505..7b813036b485 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c | |||
@@ -76,7 +76,7 @@ static int isd200_Initialization(struct us_data *us); | |||
76 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | 76 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ |
77 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | 77 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } |
78 | 78 | ||
79 | struct usb_device_id isd200_usb_ids[] = { | 79 | static struct usb_device_id isd200_usb_ids[] = { |
80 | # include "unusual_isd200.h" | 80 | # include "unusual_isd200.h" |
81 | { } /* Terminating entry */ | 81 | { } /* Terminating entry */ |
82 | }; | 82 | }; |
diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c index 6168596c5ac6..5ef55c7d73e1 100644 --- a/drivers/usb/storage/jumpshot.c +++ b/drivers/usb/storage/jumpshot.c | |||
@@ -71,7 +71,7 @@ MODULE_LICENSE("GPL"); | |||
71 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | 71 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ |
72 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | 72 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } |
73 | 73 | ||
74 | struct usb_device_id jumpshot_usb_ids[] = { | 74 | static struct usb_device_id jumpshot_usb_ids[] = { |
75 | # include "unusual_jumpshot.h" | 75 | # include "unusual_jumpshot.h" |
76 | { } /* Terminating entry */ | 76 | { } /* Terminating entry */ |
77 | }; | 77 | }; |
diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c index ba1b78906880..fb5bfb00d797 100644 --- a/drivers/usb/storage/karma.c +++ b/drivers/usb/storage/karma.c | |||
@@ -59,7 +59,7 @@ static int rio_karma_init(struct us_data *us); | |||
59 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | 59 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ |
60 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | 60 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } |
61 | 61 | ||
62 | struct usb_device_id karma_usb_ids[] = { | 62 | static struct usb_device_id karma_usb_ids[] = { |
63 | # include "unusual_karma.h" | 63 | # include "unusual_karma.h" |
64 | { } /* Terminating entry */ | 64 | { } /* Terminating entry */ |
65 | }; | 65 | }; |
diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c index 1943be5a2914..d29be3e81134 100644 --- a/drivers/usb/storage/onetouch.c +++ b/drivers/usb/storage/onetouch.c | |||
@@ -69,7 +69,7 @@ struct usb_onetouch { | |||
69 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | 69 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ |
70 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | 70 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } |
71 | 71 | ||
72 | struct usb_device_id onetouch_usb_ids[] = { | 72 | static struct usb_device_id onetouch_usb_ids[] = { |
73 | # include "unusual_onetouch.h" | 73 | # include "unusual_onetouch.h" |
74 | { } /* Terminating entry */ | 74 | { } /* Terminating entry */ |
75 | }; | 75 | }; |
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c index 0ce5f79197e7..71147679cb11 100644 --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c | |||
@@ -398,10 +398,9 @@ static int rts51x_write_mem(struct us_data *us, u16 addr, u8 *data, u16 len) | |||
398 | u8 cmnd[12] = { 0 }; | 398 | u8 cmnd[12] = { 0 }; |
399 | u8 *buf; | 399 | u8 *buf; |
400 | 400 | ||
401 | buf = kmalloc(len, GFP_NOIO); | 401 | buf = kmemdup(data, len, GFP_NOIO); |
402 | if (buf == NULL) | 402 | if (buf == NULL) |
403 | return USB_STOR_TRANSPORT_ERROR; | 403 | return USB_STOR_TRANSPORT_ERROR; |
404 | memcpy(buf, data, len); | ||
405 | 404 | ||
406 | US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len); | 405 | US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len); |
407 | 406 | ||
@@ -507,15 +506,14 @@ static int enable_oscillator(struct us_data *us) | |||
507 | static int __do_config_autodelink(struct us_data *us, u8 *data, u16 len) | 506 | static int __do_config_autodelink(struct us_data *us, u8 *data, u16 len) |
508 | { | 507 | { |
509 | int retval; | 508 | int retval; |
510 | u16 addr = 0xFE47; | ||
511 | u8 cmnd[12] = {0}; | 509 | u8 cmnd[12] = {0}; |
512 | 510 | ||
513 | US_DEBUGP("%s, addr = 0x%x, len = %d\n", __FUNCTION__, addr, len); | 511 | US_DEBUGP("%s, addr = 0xfe47, len = %d\n", __FUNCTION__, len); |
514 | 512 | ||
515 | cmnd[0] = 0xF0; | 513 | cmnd[0] = 0xF0; |
516 | cmnd[1] = 0x0E; | 514 | cmnd[1] = 0x0E; |
517 | cmnd[2] = (u8)(addr >> 8); | 515 | cmnd[2] = 0xfe; |
518 | cmnd[3] = (u8)addr; | 516 | cmnd[3] = 0x47; |
519 | cmnd[4] = (u8)(len >> 8); | 517 | cmnd[4] = (u8)(len >> 8); |
520 | cmnd[5] = (u8)len; | 518 | cmnd[5] = (u8)len; |
521 | 519 | ||
@@ -818,7 +816,7 @@ static inline int working_scsi(struct scsi_cmnd *srb) | |||
818 | return 1; | 816 | return 1; |
819 | } | 817 | } |
820 | 818 | ||
821 | void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) | 819 | static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) |
822 | { | 820 | { |
823 | struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); | 821 | struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); |
824 | static int card_first_show = 1; | 822 | static int card_first_show = 1; |
@@ -977,7 +975,7 @@ static void realtek_cr_destructor(void *extra) | |||
977 | } | 975 | } |
978 | 976 | ||
979 | #ifdef CONFIG_PM | 977 | #ifdef CONFIG_PM |
980 | int realtek_cr_suspend(struct usb_interface *iface, pm_message_t message) | 978 | static int realtek_cr_suspend(struct usb_interface *iface, pm_message_t message) |
981 | { | 979 | { |
982 | struct us_data *us = usb_get_intfdata(iface); | 980 | struct us_data *us = usb_get_intfdata(iface); |
983 | 981 | ||
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c index bcb9a709d349..6ecbf44c7ecb 100644 --- a/drivers/usb/storage/sddr09.c +++ b/drivers/usb/storage/sddr09.c | |||
@@ -71,7 +71,7 @@ static int usb_stor_sddr09_init(struct us_data *us); | |||
71 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | 71 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ |
72 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | 72 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } |
73 | 73 | ||
74 | struct usb_device_id sddr09_usb_ids[] = { | 74 | static struct usb_device_id sddr09_usb_ids[] = { |
75 | # include "unusual_sddr09.h" | 75 | # include "unusual_sddr09.h" |
76 | { } /* Terminating entry */ | 76 | { } /* Terminating entry */ |
77 | }; | 77 | }; |
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c index 44dfed7754ed..f2930441a2fa 100644 --- a/drivers/usb/storage/sddr55.c +++ b/drivers/usb/storage/sddr55.c | |||
@@ -48,7 +48,7 @@ MODULE_LICENSE("GPL"); | |||
48 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | 48 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ |
49 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | 49 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } |
50 | 50 | ||
51 | struct usb_device_id sddr55_usb_ids[] = { | 51 | static struct usb_device_id sddr55_usb_ids[] = { |
52 | # include "unusual_sddr55.h" | 52 | # include "unusual_sddr55.h" |
53 | { } /* Terminating entry */ | 53 | { } /* Terminating entry */ |
54 | }; | 54 | }; |
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c index 0b00091d2ae9..7d642c8efed3 100644 --- a/drivers/usb/storage/shuttle_usbat.c +++ b/drivers/usb/storage/shuttle_usbat.c | |||
@@ -170,7 +170,7 @@ static int init_usbat_flash(struct us_data *us); | |||
170 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | 170 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ |
171 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | 171 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } |
172 | 172 | ||
173 | struct usb_device_id usbat_usb_ids[] = { | 173 | static struct usb_device_id usbat_usb_ids[] = { |
174 | # include "unusual_usbat.h" | 174 | # include "unusual_usbat.h" |
175 | { } /* Terminating entry */ | 175 | { } /* Terminating entry */ |
176 | }; | 176 | }; |
diff --git a/drivers/usb/wusbcore/security.c b/drivers/usb/wusbcore/security.c index 371f61733f05..fa810a83e830 100644 --- a/drivers/usb/wusbcore/security.c +++ b/drivers/usb/wusbcore/security.c | |||
@@ -354,7 +354,7 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev, | |||
354 | struct wusb_keydvt_in keydvt_in; | 354 | struct wusb_keydvt_in keydvt_in; |
355 | struct wusb_keydvt_out keydvt_out; | 355 | struct wusb_keydvt_out keydvt_out; |
356 | 356 | ||
357 | hs = kzalloc(3*sizeof(hs[0]), GFP_KERNEL); | 357 | hs = kcalloc(3, sizeof(hs[0]), GFP_KERNEL); |
358 | if (hs == NULL) { | 358 | if (hs == NULL) { |
359 | dev_err(dev, "can't allocate handshake data\n"); | 359 | dev_err(dev, "can't allocate handshake data\n"); |
360 | goto error_kzalloc; | 360 | goto error_kzalloc; |