diff options
Diffstat (limited to 'drivers/usb/class/cdc-acm.c')
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 118 |
1 files changed, 12 insertions, 106 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 900f7ff805ee..3e7560f004f8 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -262,7 +262,6 @@ static void acm_ctrl_irq(struct urb *urb) struct usb_cdc_notification *dr = urb->transfer_buffer; unsigned char *data; int newctrl; - int difference; int retval; int status = urb->status; @@ -303,31 +302,20 @@ static void acm_ctrl_irq(struct urb *urb) tty_port_tty_hangup(&acm->port, false); } - difference = acm->ctrlin ^ newctrl; - spin_lock(&acm->read_lock); acm->ctrlin = newctrl; - acm->oldcount = acm->iocount; - - if (difference & ACM_CTRL_DSR) - acm->iocount.dsr++; - if (difference & ACM_CTRL_BRK) - acm->iocount.brk++; - if (difference & ACM_CTRL_RI) - acm->iocount.rng++; - if (difference & ACM_CTRL_DCD) - acm->iocount.dcd++; - if (difference & ACM_CTRL_FRAMING) - acm->iocount.frame++; - if (difference & ACM_CTRL_PARITY) - acm->iocount.parity++; - if (difference & ACM_CTRL_OVERRUN) - acm->iocount.overrun++; - spin_unlock(&acm->read_lock); - - if (difference) - wake_up_all(&acm->wioctl); - break; + dev_dbg(&acm->control->dev, + "%s - input control lines: dcd%c dsr%c break%c " + "ring%c framing%c parity%c overrun%c\n", + __func__, + acm->ctrlin & ACM_CTRL_DCD ? '+' : '-', + acm->ctrlin & ACM_CTRL_DSR ? '+' : '-', + acm->ctrlin & ACM_CTRL_BRK ? '+' : '-', + acm->ctrlin & ACM_CTRL_RI ? '+' : '-', + acm->ctrlin & ACM_CTRL_FRAMING ? '+' : '-', + acm->ctrlin & ACM_CTRL_PARITY ? '+' : '-', + acm->ctrlin & ACM_CTRL_OVERRUN ? '+' : '-'); + break; default: dev_dbg(&acm->control->dev, @@ -808,72 +796,6 @@ static int set_serial_info(struct acm *acm, return retval; } -static int wait_serial_change(struct acm *acm, unsigned long arg) -{ - int rv = 0; - DECLARE_WAITQUEUE(wait, current); - struct async_icount old, new; - - if (arg & (TIOCM_DSR | TIOCM_RI | TIOCM_CD )) - return -EINVAL; - do { - spin_lock_irq(&acm->read_lock); - old = acm->oldcount; - new = acm->iocount; - acm->oldcount = new; - spin_unlock_irq(&acm->read_lock); - - if ((arg & TIOCM_DSR) && - old.dsr != new.dsr) - break; - if ((arg & TIOCM_CD) && - old.dcd != new.dcd) - break; - if ((arg & TIOCM_RI) && - old.rng != new.rng) - break; - - add_wait_queue(&acm->wioctl, &wait); - set_current_state(TASK_INTERRUPTIBLE); - schedule(); - remove_wait_queue(&acm->wioctl, &wait); - if (acm->disconnected) { - if (arg & TIOCM_CD) - break; - else - rv = -ENODEV; - } else { - if (signal_pending(current)) - rv = -ERESTARTSYS; - } - } while (!rv); - - - - return rv; -} - -static int get_serial_usage(struct acm *acm, - struct serial_icounter_struct __user *count) -{ - struct serial_icounter_struct icount; - int rv = 0; - - memset(&icount, 0, sizeof(icount)); - icount.dsr = acm->iocount.dsr; - icount.rng = acm->iocount.rng; - icount.dcd = acm->iocount.dcd; - icount.frame = acm->iocount.frame; - icount.overrun = acm->iocount.overrun; - icount.parity = acm->iocount.parity; - icount.brk = acm->iocount.brk; - - if (copy_to_user(count, &icount, sizeof(icount)) > 0) - rv = -EFAULT; - - return rv; -} - static int acm_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { @@ -887,18 +809,6 @@ static int acm_tty_ioctl(struct tty_struct *tty, case TIOCSSERIAL: rv = set_serial_info(acm, (struct serial_struct __user *) arg); break; - case TIOCMIWAIT: - rv = usb_autopm_get_interface(acm->control); - if (rv < 0) { - rv = -EIO; - break; - } - rv = wait_serial_change(acm, arg); - usb_autopm_put_interface(acm->control); - break; - case TIOCGICOUNT: - rv = get_serial_usage(acm, (struct serial_icounter_struct __user *) arg); - break; } return rv; @@ -1257,7 +1167,6 @@ made_compressed_probe: acm->readsize = readsize; acm->rx_buflimit = num_rx_buf; INIT_WORK(&acm->work, acm_softint); - init_waitqueue_head(&acm->wioctl); spin_lock_init(&acm->write_lock); spin_lock_init(&acm->read_lock); mutex_init(&acm->mutex); @@ -1474,7 +1383,6 @@ static void acm_disconnect(struct usb_interface *intf) device_remove_file(&acm->control->dev, &dev_attr_iCountryCodeRelDate); } - wake_up_all(&acm->wioctl); device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); usb_set_intfdata(acm->control, NULL); usb_set_intfdata(acm->data, NULL); @@ -1607,8 +1515,6 @@ static int acm_reset_resume(struct usb_interface *intf) static const struct usb_device_id acm_ids[] = { /* quirky and broken devices */ - { USB_DEVICE(0x17ef, 0x7000), /* Lenovo USB modem */ - .driver_info = NO_UNION_NORMAL, },/* has no union descriptor */ { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ }, |