summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/mos7840.c
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-03-21 12:37:17 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 13:52:24 -0700
commit0c61337138763cb24901f394306715019f3272a6 (patch)
treef820e43ff117d66033275714ccb55c61057fa7e1 /drivers/usb/serial/mos7840.c
parent8c1a07ff7f28549881db0885074feb3e02b07ddb (diff)
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: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/mos7840.c')
-rw-r--r--drivers/usb/serial/mos7840.c48
1 files changed, 2 insertions, 46 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 92feae6e8851..f0b4e5c01e13 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -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,