diff options
author | Johan Hovold <jhovold@gmail.com> | 2013-03-21 07:37:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-25 16:52:28 -0400 |
commit | 6c75e26067c8b8a17aea1bb54b9a8dc9d229c5e8 (patch) | |
tree | 734172d2847952f5c22c294c733cec8e69d3e75f /drivers/usb | |
parent | 783ca3557b83b915d1b7a47240e7ab6acca0aac8 (diff) |
USB: ti_usb_3410_5052: switch to generic TIOCMIWAIT implementation
Switch to the generic TIOCMIWAIT implementation which does not suffer
from the races involved when using the deprecated sleep_on functions.
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')
-rw-r--r-- | drivers/usb/serial/ti_usb_3410_5052.c | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 999772538374..07268591b0d1 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -232,6 +232,7 @@ static struct usb_serial_driver ti_1port_device = { | |||
232 | .set_termios = ti_set_termios, | 232 | .set_termios = ti_set_termios, |
233 | .tiocmget = ti_tiocmget, | 233 | .tiocmget = ti_tiocmget, |
234 | .tiocmset = ti_tiocmset, | 234 | .tiocmset = ti_tiocmset, |
235 | .tiocmiwait = usb_serial_generic_tiocmiwait, | ||
235 | .get_icount = usb_serial_generic_get_icount, | 236 | .get_icount = usb_serial_generic_get_icount, |
236 | .break_ctl = ti_break, | 237 | .break_ctl = ti_break, |
237 | .read_int_callback = ti_interrupt_callback, | 238 | .read_int_callback = ti_interrupt_callback, |
@@ -262,6 +263,7 @@ static struct usb_serial_driver ti_2port_device = { | |||
262 | .set_termios = ti_set_termios, | 263 | .set_termios = ti_set_termios, |
263 | .tiocmget = ti_tiocmget, | 264 | .tiocmget = ti_tiocmget, |
264 | .tiocmset = ti_tiocmset, | 265 | .tiocmset = ti_tiocmset, |
266 | .tiocmiwait = usb_serial_generic_tiocmiwait, | ||
265 | .get_icount = usb_serial_generic_get_icount, | 267 | .get_icount = usb_serial_generic_get_icount, |
266 | .break_ctl = ti_break, | 268 | .break_ctl = ti_break, |
267 | .read_int_callback = ti_interrupt_callback, | 269 | .read_int_callback = ti_interrupt_callback, |
@@ -731,8 +733,6 @@ static int ti_ioctl(struct tty_struct *tty, | |||
731 | { | 733 | { |
732 | struct usb_serial_port *port = tty->driver_data; | 734 | struct usb_serial_port *port = tty->driver_data; |
733 | struct ti_port *tport = usb_get_serial_port_data(port); | 735 | struct ti_port *tport = usb_get_serial_port_data(port); |
734 | struct async_icount cnow; | ||
735 | struct async_icount cprev; | ||
736 | 736 | ||
737 | dev_dbg(&port->dev, "%s - cmd = 0x%04X\n", __func__, cmd); | 737 | dev_dbg(&port->dev, "%s - cmd = 0x%04X\n", __func__, cmd); |
738 | 738 | ||
@@ -748,29 +748,6 @@ static int ti_ioctl(struct tty_struct *tty, | |||
748 | dev_dbg(&port->dev, "%s - TIOCSSERIAL\n", __func__); | 748 | dev_dbg(&port->dev, "%s - TIOCSSERIAL\n", __func__); |
749 | return ti_set_serial_info(tty, tport, | 749 | return ti_set_serial_info(tty, tport, |
750 | (struct serial_struct __user *)arg); | 750 | (struct serial_struct __user *)arg); |
751 | case TIOCMIWAIT: | ||
752 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); | ||
753 | cprev = port->icount; | ||
754 | while (1) { | ||
755 | interruptible_sleep_on(&port->delta_msr_wait); | ||
756 | if (signal_pending(current)) | ||
757 | return -ERESTARTSYS; | ||
758 | |||
759 | if (port->serial->disconnected) | ||
760 | return -EIO; | ||
761 | |||
762 | cnow = port->icount; | ||
763 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | ||
764 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | ||
765 | return -EIO; /* no change => error */ | ||
766 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || | ||
767 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || | ||
768 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || | ||
769 | ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) | ||
770 | return 0; | ||
771 | cprev = cnow; | ||
772 | } | ||
773 | break; | ||
774 | } | 751 | } |
775 | return -ENOIOCTLCMD; | 752 | return -ENOIOCTLCMD; |
776 | } | 753 | } |
@@ -1364,7 +1341,7 @@ static void ti_handle_new_msr(struct ti_port *tport, __u8 msr) | |||
1364 | icount->dcd++; | 1341 | icount->dcd++; |
1365 | if (msr & TI_MSR_DELTA_RI) | 1342 | if (msr & TI_MSR_DELTA_RI) |
1366 | icount->rng++; | 1343 | icount->rng++; |
1367 | wake_up_interruptible(&tport->tp_port->delta_msr_wait); | 1344 | wake_up_interruptible(&tport->tp_port->port.delta_msr_wait); |
1368 | spin_unlock_irqrestore(&tport->tp_lock, flags); | 1345 | spin_unlock_irqrestore(&tport->tp_lock, flags); |
1369 | } | 1346 | } |
1370 | 1347 | ||