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

USB: mos7840: 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>
上级 8c1a07ff
......@@ -219,7 +219,6 @@ struct moschip_port {
char open;
char open_ports;
wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */
int delta_msr_cond;
struct usb_serial_port *port; /* loop back to the owner of this object */
/* Offsets */
......@@ -413,8 +412,7 @@ static void mos7840_handle_new_msr(struct moschip_port *port, __u8 new_msr)
if (new_msr & MOS_MSR_DELTA_RI)
icount->rng++;
mos7840_port->delta_msr_cond = 1;
wake_up_interruptible(&port->port->delta_msr_wait);
wake_up_interruptible(&port->port->port.delta_msr_wait);
}
}
......@@ -2113,9 +2111,6 @@ static int mos7840_ioctl(struct tty_struct *tty,
struct usb_serial_port *port = tty->driver_data;
void __user *argp = (void __user *)arg;
struct moschip_port *mos7840_port;
unsigned long flags;
struct async_icount cnow;
struct async_icount cprev;
if (mos7840_port_paranoia_check(port, __func__))
return -1;
......@@ -2141,46 +2136,6 @@ static int mos7840_ioctl(struct tty_struct *tty,
case TIOCSSERIAL:
dev_dbg(&port->dev, "%s TIOCSSERIAL\n", __func__);
break;
case TIOCMIWAIT:
dev_dbg(&port->dev, "%s TIOCMIWAIT\n", __func__);
spin_lock_irqsave(&port->lock, flags);
cprev = port->icount;
spin_unlock_irqrestore(&port->lock, flags);
while (1) {
/* interruptible_sleep_on(&mos7840_port->delta_msr_wait); */
mos7840_port->delta_msr_cond = 0;
wait_event_interruptible(port->delta_msr_wait,
(port->serial->disconnected ||
mos7840_port->
delta_msr_cond == 1));
/* see if a signal did it */
if (signal_pending(current))
return -ERESTARTSYS;
if (port->serial->disconnected)
return -EIO;
spin_lock_irqsave(&port->lock, flags);
cnow = port->icount;
spin_unlock_irqrestore(&port->lock, flags);
if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)
return -EIO; /* no change => error */
if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) {
return 0;
}
cprev = cnow;
}
/* NOTREACHED */
break;
default:
break;
}
......@@ -2527,6 +2482,7 @@ static struct usb_serial_driver moschip7840_4port_device = {
.break_ctl = mos7840_break,
.tiocmget = mos7840_tiocmget,
.tiocmset = mos7840_tiocmset,
.tiocmiwait = usb_serial_generic_tiocmiwait,
.get_icount = usb_serial_generic_get_icount,
.port_probe = mos7840_port_probe,
.port_remove = mos7840_port_remove,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册