diff options
Diffstat (limited to 'drivers/usb/class')
| -rw-r--r-- | drivers/usb/class/cdc-acm.c | 73 | ||||
| -rw-r--r-- | drivers/usb/class/cdc-acm.h | 1 | ||||
| -rw-r--r-- | drivers/usb/class/cdc-wdm.c | 2 |
3 files changed, 1 insertions, 75 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 27346d69f393..f9b40a9dc4d3 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -780,20 +780,9 @@ static int acm_tty_write(struct tty_struct *tty, | |||
| 780 | } | 780 | } |
| 781 | 781 | ||
| 782 | if (acm->susp_count) { | 782 | if (acm->susp_count) { |
| 783 | if (acm->putbuffer) { | ||
| 784 | /* now to preserve order */ | ||
| 785 | usb_anchor_urb(acm->putbuffer->urb, &acm->delayed); | ||
| 786 | acm->putbuffer = NULL; | ||
| 787 | } | ||
| 788 | usb_anchor_urb(wb->urb, &acm->delayed); | 783 | usb_anchor_urb(wb->urb, &acm->delayed); |
| 789 | spin_unlock_irqrestore(&acm->write_lock, flags); | 784 | spin_unlock_irqrestore(&acm->write_lock, flags); |
| 790 | return count; | 785 | return count; |
| 791 | } else { | ||
| 792 | if (acm->putbuffer) { | ||
| 793 | /* at this point there is no good way to handle errors */ | ||
| 794 | acm_start_wb(acm, acm->putbuffer); | ||
| 795 | acm->putbuffer = NULL; | ||
| 796 | } | ||
| 797 | } | 786 | } |
| 798 | 787 | ||
| 799 | stat = acm_start_wb(acm, wb); | 788 | stat = acm_start_wb(acm, wb); |
| @@ -804,66 +793,6 @@ static int acm_tty_write(struct tty_struct *tty, | |||
| 804 | return count; | 793 | return count; |
| 805 | } | 794 | } |
| 806 | 795 | ||
| 807 | static void acm_tty_flush_chars(struct tty_struct *tty) | ||
| 808 | { | ||
| 809 | struct acm *acm = tty->driver_data; | ||
| 810 | struct acm_wb *cur; | ||
| 811 | int err; | ||
| 812 | unsigned long flags; | ||
| 813 | |||
| 814 | spin_lock_irqsave(&acm->write_lock, flags); | ||
| 815 | |||
| 816 | cur = acm->putbuffer; | ||
| 817 | if (!cur) /* nothing to do */ | ||
| 818 | goto out; | ||
| 819 | |||
| 820 | acm->putbuffer = NULL; | ||
| 821 | err = usb_autopm_get_interface_async(acm->control); | ||
| 822 | if (err < 0) { | ||
| 823 | cur->use = 0; | ||
| 824 | acm->putbuffer = cur; | ||
| 825 | goto out; | ||
| 826 | } | ||
| 827 | |||
| 828 | if (acm->susp_count) | ||
| 829 | usb_anchor_urb(cur->urb, &acm->delayed); | ||
| 830 | else | ||
| 831 | acm_start_wb(acm, cur); | ||
| 832 | out: | ||
| 833 | spin_unlock_irqrestore(&acm->write_lock, flags); | ||
| 834 | return; | ||
| 835 | } | ||
| 836 | |||
| 837 | static int acm_tty_put_char(struct tty_struct *tty, unsigned char ch) | ||
| 838 | { | ||
| 839 | struct acm *acm = tty->driver_data; | ||
| 840 | struct acm_wb *cur; | ||
| 841 | int wbn; | ||
| 842 | unsigned long flags; | ||
| 843 | |||
| 844 | overflow: | ||
| 845 | cur = acm->putbuffer; | ||
| 846 | if (!cur) { | ||
| 847 | spin_lock_irqsave(&acm->write_lock, flags); | ||
| 848 | wbn = acm_wb_alloc(acm); | ||
| 849 | if (wbn >= 0) { | ||
| 850 | cur = &acm->wb[wbn]; | ||
| 851 | acm->putbuffer = cur; | ||
| 852 | } | ||
| 853 | spin_unlock_irqrestore(&acm->write_lock, flags); | ||
| 854 | if (!cur) | ||
| 855 | return 0; | ||
| 856 | } | ||
| 857 | |||
| 858 | if (cur->len == acm->writesize) { | ||
| 859 | acm_tty_flush_chars(tty); | ||
| 860 | goto overflow; | ||
| 861 | } | ||
| 862 | |||
| 863 | cur->buf[cur->len++] = ch; | ||
| 864 | return 1; | ||
| 865 | } | ||
| 866 | |||
| 867 | static int acm_tty_write_room(struct tty_struct *tty) | 796 | static int acm_tty_write_room(struct tty_struct *tty) |
| 868 | { | 797 | { |
| 869 | struct acm *acm = tty->driver_data; | 798 | struct acm *acm = tty->driver_data; |
| @@ -1987,8 +1916,6 @@ static const struct tty_operations acm_ops = { | |||
| 1987 | .cleanup = acm_tty_cleanup, | 1916 | .cleanup = acm_tty_cleanup, |
| 1988 | .hangup = acm_tty_hangup, | 1917 | .hangup = acm_tty_hangup, |
| 1989 | .write = acm_tty_write, | 1918 | .write = acm_tty_write, |
| 1990 | .put_char = acm_tty_put_char, | ||
| 1991 | .flush_chars = acm_tty_flush_chars, | ||
| 1992 | .write_room = acm_tty_write_room, | 1919 | .write_room = acm_tty_write_room, |
| 1993 | .ioctl = acm_tty_ioctl, | 1920 | .ioctl = acm_tty_ioctl, |
| 1994 | .throttle = acm_tty_throttle, | 1921 | .throttle = acm_tty_throttle, |
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h index eacc116e83da..ca06b20d7af9 100644 --- a/drivers/usb/class/cdc-acm.h +++ b/drivers/usb/class/cdc-acm.h | |||
| @@ -96,7 +96,6 @@ struct acm { | |||
| 96 | unsigned long read_urbs_free; | 96 | unsigned long read_urbs_free; |
| 97 | struct urb *read_urbs[ACM_NR]; | 97 | struct urb *read_urbs[ACM_NR]; |
| 98 | struct acm_rb read_buffers[ACM_NR]; | 98 | struct acm_rb read_buffers[ACM_NR]; |
| 99 | struct acm_wb *putbuffer; /* for acm_tty_put_char() */ | ||
| 100 | int rx_buflimit; | 99 | int rx_buflimit; |
| 101 | spinlock_t read_lock; | 100 | spinlock_t read_lock; |
| 102 | u8 *notification_buffer; /* to reassemble fragmented notifications */ | 101 | u8 *notification_buffer; /* to reassemble fragmented notifications */ |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index bec581fb7c63..656d247819c9 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
| @@ -460,7 +460,7 @@ static int service_outstanding_interrupt(struct wdm_device *desc) | |||
| 460 | 460 | ||
| 461 | set_bit(WDM_RESPONDING, &desc->flags); | 461 | set_bit(WDM_RESPONDING, &desc->flags); |
| 462 | spin_unlock_irq(&desc->iuspin); | 462 | spin_unlock_irq(&desc->iuspin); |
| 463 | rv = usb_submit_urb(desc->response, GFP_KERNEL); | 463 | rv = usb_submit_urb(desc->response, GFP_ATOMIC); |
| 464 | spin_lock_irq(&desc->iuspin); | 464 | spin_lock_irq(&desc->iuspin); |
| 465 | if (rv) { | 465 | if (rv) { |
| 466 | dev_err(&desc->intf->dev, | 466 | dev_err(&desc->intf->dev, |
