summaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ch341.c
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2014-01-02 22:49:29 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-03 12:42:24 -0800
commitb770081f88b75212d61a63a84274e491eb54b25a (patch)
tree8eeb43423756f4a7839d26c4cd1989001f8ec7d7 /drivers/usb/serial/ch341.c
parentac035628a95f20ff4c53b80c4b80e12287231e1a (diff)
downloadtalos-obmc-linux-b770081f88b75212d61a63a84274e491eb54b25a.tar.gz
talos-obmc-linux-b770081f88b75212d61a63a84274e491eb54b25a.zip
USB: ch341: clean up line-status handling
Clean up line-status handling. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/ch341.c')
-rw-r--r--drivers/usb/serial/ch341.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index f647dbdcb27d..9dd94a7e08b9 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -444,24 +444,30 @@ static void ch341_update_line_status(struct usb_serial_port *port,
unsigned char *data, size_t len)
{
struct ch341_private *priv = usb_get_serial_port_data(port);
+ struct tty_struct *tty;
unsigned long flags;
- u8 prev_line_status = priv->line_status;
+ u8 status;
+ u8 delta;
if (len < 4)
return;
+ status = ~data[2] & CH341_BITS_MODEM_STAT;
+
spin_lock_irqsave(&priv->lock, flags);
- priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT;
- if ((data[1] & CH341_MULT_STAT))
+ delta = status ^ priv->line_status;
+ priv->line_status = status;
+ if (data[1] & CH341_MULT_STAT)
priv->multi_status_change = 1;
spin_unlock_irqrestore(&priv->lock, flags);
- if ((priv->line_status ^ prev_line_status) & CH341_BIT_DCD) {
- struct tty_struct *tty = tty_port_tty_get(&port->port);
- if (tty)
+ if (delta & CH341_BIT_DCD) {
+ tty = tty_port_tty_get(&port->port);
+ if (tty) {
usb_serial_handle_dcd_change(port, tty,
- priv->line_status & CH341_BIT_DCD);
- tty_kref_put(tty);
+ status & CH341_BIT_DCD);
+ tty_kref_put(tty);
+ }
}
wake_up_interruptible(&port->port.delta_msr_wait);
OpenPOWER on IntegriCloud