提交 b5959704 编写于 作者: J Johan Hovold 提交者: Greg Kroah-Hartman

USB: quatech2: 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: NJohan Hovold <jhovold@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 0a4142fb
...@@ -492,49 +492,6 @@ static int get_serial_info(struct usb_serial_port *port, ...@@ -492,49 +492,6 @@ static int get_serial_info(struct usb_serial_port *port,
return 0; return 0;
} }
static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
{
struct qt2_port_private *priv = usb_get_serial_port_data(port);
struct async_icount prev, cur;
unsigned long flags;
spin_lock_irqsave(&priv->lock, flags);
prev = port->icount;
spin_unlock_irqrestore(&priv->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->lock, flags);
cur = port->icount;
spin_unlock_irqrestore(&priv->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 qt2_ioctl(struct tty_struct *tty, static int qt2_ioctl(struct tty_struct *tty,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
...@@ -544,10 +501,6 @@ static int qt2_ioctl(struct tty_struct *tty, ...@@ -544,10 +501,6 @@ static int qt2_ioctl(struct tty_struct *tty,
case TIOCGSERIAL: case TIOCGSERIAL:
return get_serial_info(port, return get_serial_info(port,
(struct serial_struct __user *)arg); (struct serial_struct __user *)arg);
case TIOCMIWAIT:
return wait_modem_info(port, arg);
default: default:
break; break;
} }
...@@ -942,7 +895,7 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch) ...@@ -942,7 +895,7 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch)
if (newMSR & UART_MSR_TERI) if (newMSR & UART_MSR_TERI)
port->icount.rng++; port->icount.rng++;
wake_up_interruptible(&port->delta_msr_wait); wake_up_interruptible(&port->port.delta_msr_wait);
} }
} }
...@@ -1072,6 +1025,7 @@ static struct usb_serial_driver qt2_device = { ...@@ -1072,6 +1025,7 @@ static struct usb_serial_driver qt2_device = {
.break_ctl = qt2_break_ctl, .break_ctl = qt2_break_ctl,
.tiocmget = qt2_tiocmget, .tiocmget = qt2_tiocmget,
.tiocmset = qt2_tiocmset, .tiocmset = qt2_tiocmset,
.tiocmiwait = usb_serial_generic_tiocmiwait,
.get_icount = usb_serial_generic_get_icount, .get_icount = usb_serial_generic_get_icount,
.ioctl = qt2_ioctl, .ioctl = qt2_ioctl,
.set_termios = qt2_set_termios, .set_termios = qt2_set_termios,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册