From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752902AbcD3CWl (ORCPT ); Fri, 29 Apr 2016 22:22:41 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:35485 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752334AbcD3CWi (ORCPT ); Fri, 29 Apr 2016 22:22:38 -0400 From: Konstantin Shkolnyy To: johan@kernel.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Konstantin Shkolnyy Subject: [PATCH v2 3/3] USB: serial: cp210x: Cleaned up CRTSCTS flag code. Date: Fri, 29 Apr 2016 21:22:35 -0500 Message-Id: <1461982955-19699-1-git-send-email-konstantin.shkolnyy@gmail.com> X-Mailer: git-send-email 1.8.4.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes in v2: Improved CRTSCTS fix based on feedback. Dropped get_termios error handling. drivers/usb/serial/cp210x.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index da0567c..d3e1dd2 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -988,24 +988,21 @@ static void cp210x_set_termios(struct tty_struct *tty, dev_dbg(dev, "%s - read ulControlHandshake=%08x ulFlowReplace=%08x\n", __func__, ControlHandshake, FlowReplace); + ControlHandshake &= ~SERIAL_DSR_HANDSHAKE; + ControlHandshake &= ~SERIAL_DCD_HANDSHAKE; + ControlHandshake &= ~SERIAL_DSR_SENSITIVITY; + ControlHandshake &= ~SERIAL_DTR_MASK; + ControlHandshake |= SERIAL_DTR_ACTIVE; if (cflag & CRTSCTS) { - ControlHandshake &= ~(SERIAL_DTR_MASK | - SERIAL_CTS_HANDSHAKE | SERIAL_DSR_HANDSHAKE | - SERIAL_DCD_HANDSHAKE | SERIAL_DSR_SENSITIVITY); - ControlHandshake |= SERIAL_DTR_ACTIVE; ControlHandshake |= SERIAL_CTS_HANDSHAKE; - /* FIXME why clear bits unrelated to flow control */ - /* FIXME why clear _XOFF_CONTINUE which is never set */ - FlowReplace &= ~0xffffffff; + + FlowReplace &= ~SERIAL_RTS_MASK; FlowReplace |= SERIAL_RTS_FLOW_CTL; dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__); } else { - ControlHandshake &= ~(SERIAL_DTR_MASK | - SERIAL_CTS_HANDSHAKE | SERIAL_DSR_HANDSHAKE | - SERIAL_DCD_HANDSHAKE | SERIAL_DSR_SENSITIVITY); - ControlHandshake |= SERIAL_DTR_ACTIVE; - /* FIXME - why clear bits unrelated to flow control */ - FlowReplace &= ~0xff; + ControlHandshake &= ~SERIAL_CTS_HANDSHAKE; + + FlowReplace &= ~SERIAL_RTS_MASK; FlowReplace |= SERIAL_RTS_ACTIVE; dev_dbg(dev, "%s - flow control = NONE\n", __func__); } -- 1.8.4.5