aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-03-21 07:37:08 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 16:50:53 -0400
commit8b8070d8580c38e15979b2a88f3a4d7b02bd3bde (patch)
tree2b8e5dc09219351fa82ba4c5a75852b7e2f7fa58
parentd36a7712497b547a21bf46c3be517cb06ccb93ee (diff)
USB: io_edgeport: 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>
-rw-r--r--drivers/usb/serial/io_edgeport.c35
-rw-r--r--drivers/usb/serial/io_tables.h4
2 files changed, 5 insertions, 34 deletions
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 16ef8f3714d9..ff9a6ef8477f 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -1618,8 +1618,6 @@ static int edge_ioctl(struct tty_struct *tty,
1618 struct usb_serial_port *port = tty->driver_data; 1618 struct usb_serial_port *port = tty->driver_data;
1619 DEFINE_WAIT(wait); 1619 DEFINE_WAIT(wait);
1620 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 1620 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
1621 struct async_icount cnow;
1622 struct async_icount cprev;
1623 1621
1624 dev_dbg(&port->dev, "%s - port %d, cmd = 0x%x\n", __func__, port->number, cmd); 1622 dev_dbg(&port->dev, "%s - port %d, cmd = 0x%x\n", __func__, port->number, cmd);
1625 1623
@@ -1631,37 +1629,6 @@ static int edge_ioctl(struct tty_struct *tty,
1631 case TIOCGSERIAL: 1629 case TIOCGSERIAL:
1632 dev_dbg(&port->dev, "%s (%d) TIOCGSERIAL\n", __func__, port->number); 1630 dev_dbg(&port->dev, "%s (%d) TIOCGSERIAL\n", __func__, port->number);
1633 return get_serial_info(edge_port, (struct serial_struct __user *) arg); 1631 return get_serial_info(edge_port, (struct serial_struct __user *) arg);
1634
1635 case TIOCMIWAIT:
1636 dev_dbg(&port->dev, "%s (%d) TIOCMIWAIT\n", __func__, port->number);
1637 cprev = port->icount;
1638 while (1) {
1639 prepare_to_wait(&port->delta_msr_wait,
1640 &wait, TASK_INTERRUPTIBLE);
1641 schedule();
1642 finish_wait(&port->delta_msr_wait, &wait);
1643 /* see if a signal did it */
1644 if (signal_pending(current))
1645 return -ERESTARTSYS;
1646
1647 if (port->serial->disconnected)
1648 return -EIO;
1649
1650 cnow = port->icount;
1651 if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
1652 cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)
1653 return -EIO; /* no change => error */
1654 if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
1655 ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
1656 ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
1657 ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) {
1658 return 0;
1659 }
1660 cprev = cnow;
1661 }
1662 /* NOTREACHED */
1663 break;
1664
1665 } 1632 }
1666 return -ENOIOCTLCMD; 1633 return -ENOIOCTLCMD;
1667} 1634}
@@ -2022,7 +1989,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr)
2022 icount->dcd++; 1989 icount->dcd++;
2023 if (newMsr & EDGEPORT_MSR_DELTA_RI) 1990 if (newMsr & EDGEPORT_MSR_DELTA_RI)
2024 icount->rng++; 1991 icount->rng++;
2025 wake_up_interruptible(&edge_port->port->delta_msr_wait); 1992 wake_up_interruptible(&edge_port->port->port.delta_msr_wait);
2026 } 1993 }
2027 1994
2028 /* Save the new modem status */ 1995 /* Save the new modem status */
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h
index 35fe9ad7d3da..ae5fac5656c9 100644
--- a/drivers/usb/serial/io_tables.h
+++ b/drivers/usb/serial/io_tables.h
@@ -116,6 +116,7 @@ static struct usb_serial_driver edgeport_2port_device = {
116 .set_termios = edge_set_termios, 116 .set_termios = edge_set_termios,
117 .tiocmget = edge_tiocmget, 117 .tiocmget = edge_tiocmget,
118 .tiocmset = edge_tiocmset, 118 .tiocmset = edge_tiocmset,
119 .tiocmiwait = usb_serial_generic_tiocmiwait,
119 .get_icount = usb_serial_generic_get_icount, 120 .get_icount = usb_serial_generic_get_icount,
120 .write = edge_write, 121 .write = edge_write,
121 .write_room = edge_write_room, 122 .write_room = edge_write_room,
@@ -147,6 +148,7 @@ static struct usb_serial_driver edgeport_4port_device = {
147 .set_termios = edge_set_termios, 148 .set_termios = edge_set_termios,
148 .tiocmget = edge_tiocmget, 149 .tiocmget = edge_tiocmget,
149 .tiocmset = edge_tiocmset, 150 .tiocmset = edge_tiocmset,
151 .tiocmiwait = usb_serial_generic_tiocmiwait,
150 .get_icount = usb_serial_generic_get_icount, 152 .get_icount = usb_serial_generic_get_icount,
151 .write = edge_write, 153 .write = edge_write,
152 .write_room = edge_write_room, 154 .write_room = edge_write_room,
@@ -178,6 +180,7 @@ static struct usb_serial_driver edgeport_8port_device = {
178 .set_termios = edge_set_termios, 180 .set_termios = edge_set_termios,
179 .tiocmget = edge_tiocmget, 181 .tiocmget = edge_tiocmget,
180 .tiocmset = edge_tiocmset, 182 .tiocmset = edge_tiocmset,
183 .tiocmiwait = usb_serial_generic_tiocmiwait,
181 .get_icount = usb_serial_generic_get_icount, 184 .get_icount = usb_serial_generic_get_icount,
182 .write = edge_write, 185 .write = edge_write,
183 .write_room = edge_write_room, 186 .write_room = edge_write_room,
@@ -209,6 +212,7 @@ static struct usb_serial_driver epic_device = {
209 .set_termios = edge_set_termios, 212 .set_termios = edge_set_termios,
210 .tiocmget = edge_tiocmget, 213 .tiocmget = edge_tiocmget,
211 .tiocmset = edge_tiocmset, 214 .tiocmset = edge_tiocmset,
215 .tiocmiwait = usb_serial_generic_tiocmiwait,
212 .get_icount = usb_serial_generic_get_icount, 216 .get_icount = usb_serial_generic_get_icount,
213 .write = edge_write, 217 .write = edge_write,
214 .write_room = edge_write_room, 218 .write_room = edge_write_room,