diff options
author | Johan Hovold <jhovold@gmail.com> | 2014-01-02 16:49:23 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-03 15:42:23 -0500 |
commit | a4bcb2945926901bbacf978eb0c0fdda5b327dc7 (patch) | |
tree | 577c861a23bd2fc717026fa5aac48bc0df390d9f /drivers/usb | |
parent | dbfd2866ac36bab52a4f37384e935eb5df76ad60 (diff) |
USB: pl2303: 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.
Acked-by: Arnd Bergmann <arnd@arndb.de>
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/pl2303.c | 49 |
1 files changed, 8 insertions, 41 deletions
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 64f093f16981..abee31825fc5 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -712,46 +712,6 @@ static int pl2303_carrier_raised(struct usb_serial_port *port) | |||
712 | return 0; | 712 | return 0; |
713 | } | 713 | } |
714 | 714 | ||
715 | static int pl2303_tiocmiwait(struct tty_struct *tty, unsigned long arg) | ||
716 | { | ||
717 | struct usb_serial_port *port = tty->driver_data; | ||
718 | struct pl2303_private *priv = usb_get_serial_port_data(port); | ||
719 | unsigned long flags; | ||
720 | unsigned int prevstatus; | ||
721 | unsigned int status; | ||
722 | unsigned int changed; | ||
723 | |||
724 | spin_lock_irqsave(&priv->lock, flags); | ||
725 | prevstatus = priv->line_status; | ||
726 | spin_unlock_irqrestore(&priv->lock, flags); | ||
727 | |||
728 | while (1) { | ||
729 | interruptible_sleep_on(&port->port.delta_msr_wait); | ||
730 | /* see if a signal did it */ | ||
731 | if (signal_pending(current)) | ||
732 | return -ERESTARTSYS; | ||
733 | |||
734 | if (port->serial->disconnected) | ||
735 | return -EIO; | ||
736 | |||
737 | spin_lock_irqsave(&priv->lock, flags); | ||
738 | status = priv->line_status; | ||
739 | spin_unlock_irqrestore(&priv->lock, flags); | ||
740 | |||
741 | changed = prevstatus ^ status; | ||
742 | |||
743 | if (((arg & TIOCM_RNG) && (changed & UART_RING)) || | ||
744 | ((arg & TIOCM_DSR) && (changed & UART_DSR)) || | ||
745 | ((arg & TIOCM_CD) && (changed & UART_DCD)) || | ||
746 | ((arg & TIOCM_CTS) && (changed & UART_CTS))) { | ||
747 | return 0; | ||
748 | } | ||
749 | prevstatus = status; | ||
750 | } | ||
751 | /* NOTREACHED */ | ||
752 | return 0; | ||
753 | } | ||
754 | |||
755 | static int pl2303_ioctl(struct tty_struct *tty, | 715 | static int pl2303_ioctl(struct tty_struct *tty, |
756 | unsigned int cmd, unsigned long arg) | 716 | unsigned int cmd, unsigned long arg) |
757 | { | 717 | { |
@@ -830,7 +790,14 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
830 | usb_serial_handle_break(port); | 790 | usb_serial_handle_break(port); |
831 | 791 | ||
832 | if (delta & UART_STATE_MSR_MASK) { | 792 | if (delta & UART_STATE_MSR_MASK) { |
793 | if (delta & UART_CTS) | ||
794 | port->icount.cts++; | ||
795 | if (delta & UART_DSR) | ||
796 | port->icount.dsr++; | ||
797 | if (delta & UART_RING) | ||
798 | port->icount.rng++; | ||
833 | if (delta & UART_DCD) { | 799 | if (delta & UART_DCD) { |
800 | port->icount.dcd++; | ||
834 | tty = tty_port_tty_get(&port->port); | 801 | tty = tty_port_tty_get(&port->port); |
835 | if (tty) { | 802 | if (tty) { |
836 | usb_serial_handle_dcd_change(port, tty, | 803 | usb_serial_handle_dcd_change(port, tty, |
@@ -950,7 +917,7 @@ static struct usb_serial_driver pl2303_device = { | |||
950 | .set_termios = pl2303_set_termios, | 917 | .set_termios = pl2303_set_termios, |
951 | .tiocmget = pl2303_tiocmget, | 918 | .tiocmget = pl2303_tiocmget, |
952 | .tiocmset = pl2303_tiocmset, | 919 | .tiocmset = pl2303_tiocmset, |
953 | .tiocmiwait = pl2303_tiocmiwait, | 920 | .tiocmiwait = usb_serial_generic_tiocmiwait, |
954 | .process_read_urb = pl2303_process_read_urb, | 921 | .process_read_urb = pl2303_process_read_urb, |
955 | .read_int_callback = pl2303_read_int_callback, | 922 | .read_int_callback = pl2303_read_int_callback, |
956 | .probe = pl2303_probe, | 923 | .probe = pl2303_probe, |