diff options
author | Konstantin Shkolnyy <konstantin.shkolnyy@gmail.com> | 2016-05-05 00:57:11 +0300 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2016-05-05 12:48:09 +0300 |
commit | ab5701ada2473b111c24ca7f4360b0cdb5badb60 (patch) | |
tree | b36c3ebf4f4677a9c8f5eaf5a429d66c9afdb881 /drivers/usb | |
parent | 9034389cd81681b4f0123173eb836624199209c7 (diff) | |
download | linux-ab5701ada2473b111c24ca7f4360b0cdb5badb60.tar.xz |
USB: serial: cp210x: clean up CRTSCTS flag code
The CRTSCTS flag code cleared (and inconsistently) bits unrelated to
CRTSCTS functionality. It was also harder than necessary to read.
Signed-off-by: Konstantin Shkolnyy <konstantin.shkolnyy@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/cp210x.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index a33a4265125d..df1808201207 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -995,34 +995,22 @@ static void cp210x_set_termios(struct tty_struct *tty, dev_dbg(dev, "%s - read ulControlHandshake=0x%08x, ulFlowReplace=0x%08x\n", __func__, ctl_hs, flow_repl); + ctl_hs &= ~CP210X_SERIAL_DSR_HANDSHAKE; + ctl_hs &= ~CP210X_SERIAL_DCD_HANDSHAKE; + ctl_hs &= ~CP210X_SERIAL_DSR_SENSITIVITY; + ctl_hs &= ~CP210X_SERIAL_DTR_MASK; + ctl_hs |= CP210X_SERIAL_DTR_SHIFT(CP210X_SERIAL_DTR_ACTIVE); if (cflag & CRTSCTS) { - ctl_hs &= ~(CP210X_SERIAL_DTR_MASK | - CP210X_SERIAL_CTS_HANDSHAKE | - CP210X_SERIAL_DSR_HANDSHAKE | - CP210X_SERIAL_DCD_HANDSHAKE | - CP210X_SERIAL_DSR_SENSITIVITY); - ctl_hs |= CP210X_SERIAL_DTR_SHIFT( - CP210X_SERIAL_DTR_ACTIVE); ctl_hs |= CP210X_SERIAL_CTS_HANDSHAKE; - /* - * FIXME: Why clear bits unrelated to flow control. - * Why clear CP210X_SERIAL_XOFF_CONTINUE which is - * never set - */ - flow_repl = 0; + + flow_repl &= ~CP210X_SERIAL_RTS_MASK; flow_repl |= CP210X_SERIAL_RTS_SHIFT( CP210X_SERIAL_RTS_FLOW_CTL); dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__); } else { - ctl_hs &= ~(CP210X_SERIAL_DTR_MASK | - CP210X_SERIAL_CTS_HANDSHAKE | - CP210X_SERIAL_DSR_HANDSHAKE | - CP210X_SERIAL_DCD_HANDSHAKE | - CP210X_SERIAL_DSR_SENSITIVITY); - ctl_hs |= CP210X_SERIAL_DTR_SHIFT( - CP210X_SERIAL_DTR_ACTIVE); - /* FIXME: Why clear bits unrelated to flow control */ - flow_repl &= 0xffffff00; + ctl_hs &= ~CP210X_SERIAL_CTS_HANDSHAKE; + + flow_repl &= ~CP210X_SERIAL_RTS_MASK; flow_repl |= CP210X_SERIAL_RTS_SHIFT( CP210X_SERIAL_RTS_ACTIVE); dev_dbg(dev, "%s - flow control = NONE\n", __func__); |