diff options
author | Johan Hovold <jhovold@gmail.com> | 2013-03-21 15:37:32 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-26 00:52:28 +0400 |
commit | c24c838e8effd55ba330d1966d9846400af4bec8 (patch) | |
tree | eda7652d5694dcf7ef4816a5a9ebf9a59392da6e /drivers/usb/serial/ssu100.c | |
parent | 31ecdb6befeab20d93b49b8dd640c081b48912d0 (diff) | |
download | linux-c24c838e8effd55ba330d1966d9846400af4bec8.tar.xz |
USB: ssu100: switch to generic TIOCMIWAIT implementation
Switch to the generic TIOCMIWAIT implementation.
This also fixes the issue with processes waiting for
modem-status-changes not being woken up at disconnect.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/ssu100.c')
-rw-r--r-- | drivers/usb/serial/ssu100.c | 50 |
1 files changed, 2 insertions, 48 deletions
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index 8d94a5a7c4b6..5b62dbbdf996 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c @@ -337,49 +337,6 @@ static int get_serial_info(struct usb_serial_port *port, return 0; } -static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) -{ - struct ssu100_port_private *priv = usb_get_serial_port_data(port); - struct async_icount prev, cur; - unsigned long flags; - - spin_lock_irqsave(&priv->status_lock, flags); - prev = port->icount; - spin_unlock_irqrestore(&priv->status_lock, flags); - - while (1) { - wait_event_interruptible(port->delta_msr_wait, - (port->serial->disconnected || - (port->icount.rng != prev.rng) || - (port->icount.dsr != prev.dsr) || - (port->icount.dcd != prev.dcd) || - (port->icount.cts != prev.cts))); - - if (signal_pending(current)) - return -ERESTARTSYS; - - if (port->serial->disconnected) - return -EIO; - - spin_lock_irqsave(&priv->status_lock, flags); - cur = port->icount; - spin_unlock_irqrestore(&priv->status_lock, flags); - - if ((prev.rng == cur.rng) && - (prev.dsr == cur.dsr) && - (prev.dcd == cur.dcd) && - (prev.cts == cur.cts)) - return -EIO; - - if ((arg & TIOCM_RNG && (prev.rng != cur.rng)) || - (arg & TIOCM_DSR && (prev.dsr != cur.dsr)) || - (arg & TIOCM_CD && (prev.dcd != cur.dcd)) || - (arg & TIOCM_CTS && (prev.cts != cur.cts))) - return 0; - } - return 0; -} - static int ssu100_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { @@ -391,10 +348,6 @@ static int ssu100_ioctl(struct tty_struct *tty, case TIOCGSERIAL: return get_serial_info(port, (struct serial_struct __user *) arg); - - case TIOCMIWAIT: - return wait_modem_info(port, arg); - default: break; } @@ -509,7 +462,7 @@ static void ssu100_update_msr(struct usb_serial_port *port, u8 msr) port->icount.dcd++; if (msr & UART_MSR_TERI) port->icount.rng++; - wake_up_interruptible(&port->delta_msr_wait); + wake_up_interruptible(&port->port.delta_msr_wait); } } @@ -607,6 +560,7 @@ static struct usb_serial_driver ssu100_device = { .process_read_urb = ssu100_process_read_urb, .tiocmget = ssu100_tiocmget, .tiocmset = ssu100_tiocmset, + .tiocmiwait = usb_serial_generic_tiocmiwait, .get_icount = usb_serial_generic_get_icount, .ioctl = ssu100_ioctl, .set_termios = ssu100_set_termios, |