From patchwork Thu Apr 18 16:20:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10907653 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF4D917E0 for ; Thu, 18 Apr 2019 16:20:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8AAA28D24 for ; Thu, 18 Apr 2019 16:20:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC76A28D51; Thu, 18 Apr 2019 16:20:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FD7728D24 for ; Thu, 18 Apr 2019 16:20:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389005AbfDRQUT (ORCPT ); Thu, 18 Apr 2019 12:20:19 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:43984 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725888AbfDRQUT (ORCPT ); Thu, 18 Apr 2019 12:20:19 -0400 Received: by mail-lf1-f67.google.com with SMTP id i68so2070205lfi.10 for ; Thu, 18 Apr 2019 09:20:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VKIh/3zfog5t/yt1HIBidUiXFtzBet2TRIjomD6FHZk=; b=f2G+1pUtRPNp2rvCYHPPuCdcQ9Bo4LkTXw12zy32YFdRCaMGCDQRErcnwUavisjV2D 5+Rs7miP8Z27ztZtWYU7hpnzlO88pdM6nejKuBy0+T7NGxIddBtTchV5zovNt4T24jdC l4Sfn6+hiU5SOQaqjgVbIftTwjkioB0XEPTA8lKENVLa2SgOjrgPMOrEbGNjKzntLadN /1jcaCPb3a1IPzAUFnYMhvzYI0IVuyEfsLdr3jifbx5mE4FGEgxQjcWqI+st5quKP+L/ xsTG5zSqhIwthQAF7zXrz6v6yekmqkMT7M5qb5vwYLlr1ONAbZf6qXJr8wYU0UT/36Nf OpNw== X-Gm-Message-State: APjAAAUAemMpqs8uUYUeewNz3mctMlQtizOZuWUAuDa64udQm1emGBnE HKWG54SxIhOeIAWqU2aU6Z8ibgIe X-Google-Smtp-Source: APXvYqwrsBRdmrWbUMp68O9p1S9inQCOWlImyfg5tioJ3YzooqUwpYvrhdAd3K3e8dKzBRis0sVfHQ== X-Received: by 2002:a19:c018:: with SMTP id q24mr52514832lff.38.1555604417125; Thu, 18 Apr 2019 09:20:17 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id p18sm504130ljp.1.2019.04.18.09.20.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 09:20:15 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1hH9lx-00068r-6d; Thu, 18 Apr 2019 18:20:25 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Johan Hovold Subject: [PATCH 1/2] USB: serial: digi_acceleport: clean up modem-control handling Date: Thu, 18 Apr 2019 18:20:19 +0200 Message-Id: <20190418162020.23566-1-johan@kernel.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Clean up modem-control handling somewhat by adding missing whitespace around operators and splitting a long statement in two. Signed-off-by: Johan Hovold Reviewed-by: Greg Kroah-Hartman --- drivers/usb/serial/digi_acceleport.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index e7f244cf2c07..4699e114f617 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -569,9 +569,9 @@ static int digi_set_modem_signals(struct usb_serial_port *port, ret = usb_submit_urb(oob_port->write_urb, GFP_ATOMIC); if (ret == 0) { oob_priv->dp_write_urb_in_use = 1; - port_priv->dp_modem_signals = - (port_priv->dp_modem_signals&~(TIOCM_DTR|TIOCM_RTS)) - | (modem_signals&(TIOCM_DTR|TIOCM_RTS)); + port_priv->dp_modem_signals &= ~(TIOCM_DTR | TIOCM_RTS); + port_priv->dp_modem_signals |= + modem_signals & (TIOCM_DTR | TIOCM_RTS); } spin_unlock(&port_priv->dp_port_lock); spin_unlock_irqrestore(&oob_priv->dp_port_lock, flags); @@ -1084,7 +1084,7 @@ static int digi_chars_in_buffer(struct tty_struct *tty) static void digi_dtr_rts(struct usb_serial_port *port, int on) { /* Adjust DTR and RTS */ - digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1); + digi_set_modem_signals(port, on * (TIOCM_DTR | TIOCM_RTS), 1); } static int digi_open(struct tty_struct *tty, struct usb_serial_port *port) From patchwork Thu Apr 18 16:20:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10907651 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EBBF817E0 for ; Thu, 18 Apr 2019 16:20:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE99128D24 for ; Thu, 18 Apr 2019 16:20:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCEDB28D51; Thu, 18 Apr 2019 16:20:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9437B28D24 for ; Thu, 18 Apr 2019 16:20:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388495AbfDRQUS (ORCPT ); Thu, 18 Apr 2019 12:20:18 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:39545 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725888AbfDRQUR (ORCPT ); Thu, 18 Apr 2019 12:20:17 -0400 Received: by mail-lj1-f196.google.com with SMTP id l7so2423743ljg.6 for ; Thu, 18 Apr 2019 09:20:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=urnnXzbecz685AXtXD3Xo8I3/bPlf9IE3dOhSF7i3Eg=; b=jIdtDLCMkPC7QmMUcYhCBEFaQhoVkuHqOy0VvJJye7LSB4IjX6ZxuX8dihOSb9dz+Q UuG1vKmIeXmr+QtLhRBADj/bmMs3WTva0RrSWnm6uO2j4XEE3YV5ruhm0IREj5NdS4Qa tn1uAofr7MgY6RyKoKoGLedCKjgSFYWC+OMnrwKmqsFtVhl2a5se2HTrcFRPFyBozp6Z jyydp6go7NxNC3oFlX+tpTnSi77BC41I5lzYgMNlj3FDKKu4UOBNLnI0OdasFqhpINjB NpJfuyLVfBajUodtoxpVp1BKvwELj9LPAbYxTC2ootv5iMScN0GUnsfKcwDuQlo78t6J /hsw== X-Gm-Message-State: APjAAAW9L2iERpf9mXyGcUlC5TWXao/vRZeVe/8fwB16p6xyLOocSprP tfx3KW/pax0k3ywvWM9fMERqThgK X-Google-Smtp-Source: APXvYqwE/1U6gTBB49vVLO4SI++wq9FwU83eQS2Ph2A6Id2KK74mJMj7P6QOQHnRWSMD7ph6Yj6ksg== X-Received: by 2002:a2e:7311:: with SMTP id o17mr35351763ljc.124.1555604415489; Thu, 18 Apr 2019 09:20:15 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id o7sm500878ljj.23.2019.04.18.09.20.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 09:20:14 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1hH9lx-00068u-Az; Thu, 18 Apr 2019 18:20:25 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Johan Hovold Subject: [PATCH 2/2] USB: serial: digi_acceleport: clean up set_termios Date: Thu, 18 Apr 2019 18:20:20 +0200 Message-Id: <20190418162020.23566-2-johan@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418162020.23566-1-johan@kernel.org> References: <20190418162020.23566-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Clean up set_termios() by adding missing white space around operators and making a couple of continuation lines more readable. Also drop a couple of redundant braces. Signed-off-by: Johan Hovold Reviewed-by: Greg Kroah-Hartman --- drivers/usb/serial/digi_acceleport.c | 33 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 4699e114f617..578ebdd86520 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -740,9 +740,9 @@ static void digi_set_termios(struct tty_struct *tty, /* set parity */ tty->termios.c_cflag &= ~CMSPAR; - if ((cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD))) { - if (cflag&PARENB) { - if (cflag&PARODD) + if ((cflag & (PARENB | PARODD)) != (old_cflag & (PARENB | PARODD))) { + if (cflag & PARENB) { + if (cflag & PARODD) arg = DIGI_PARITY_ODD; else arg = DIGI_PARITY_EVEN; @@ -755,9 +755,9 @@ static void digi_set_termios(struct tty_struct *tty, buf[i++] = 0; } /* set word size */ - if ((cflag&CSIZE) != (old_cflag&CSIZE)) { + if ((cflag & CSIZE) != (old_cflag & CSIZE)) { arg = -1; - switch (cflag&CSIZE) { + switch (cflag & CSIZE) { case CS5: arg = DIGI_WORD_SIZE_5; break; case CS6: arg = DIGI_WORD_SIZE_6; break; case CS7: arg = DIGI_WORD_SIZE_7; break; @@ -765,7 +765,7 @@ static void digi_set_termios(struct tty_struct *tty, default: dev_dbg(dev, "digi_set_termios: can't handle word size %d\n", - (cflag&CSIZE)); + cflag & CSIZE); break; } @@ -779,9 +779,9 @@ static void digi_set_termios(struct tty_struct *tty, } /* set stop bits */ - if ((cflag&CSTOPB) != (old_cflag&CSTOPB)) { + if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) { - if ((cflag&CSTOPB)) + if ((cflag & CSTOPB)) arg = DIGI_STOP_BITS_2; else arg = DIGI_STOP_BITS_1; @@ -794,15 +794,15 @@ static void digi_set_termios(struct tty_struct *tty, } /* set input flow control */ - if ((iflag&IXOFF) != (old_iflag&IXOFF) - || (cflag&CRTSCTS) != (old_cflag&CRTSCTS)) { + if ((iflag & IXOFF) != (old_iflag & IXOFF) || + (cflag & CRTSCTS) != (old_cflag & CRTSCTS)) { arg = 0; - if (iflag&IXOFF) + if (iflag & IXOFF) arg |= DIGI_INPUT_FLOW_CONTROL_XON_XOFF; else arg &= ~DIGI_INPUT_FLOW_CONTROL_XON_XOFF; - if (cflag&CRTSCTS) { + if (cflag & CRTSCTS) { arg |= DIGI_INPUT_FLOW_CONTROL_RTS; /* On USB-4 it is necessary to assert RTS prior */ @@ -822,19 +822,18 @@ static void digi_set_termios(struct tty_struct *tty, } /* set output flow control */ - if ((iflag & IXON) != (old_iflag & IXON) - || (cflag & CRTSCTS) != (old_cflag & CRTSCTS)) { + if ((iflag & IXON) != (old_iflag & IXON) || + (cflag & CRTSCTS) != (old_cflag & CRTSCTS)) { arg = 0; if (iflag & IXON) arg |= DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; else arg &= ~DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; - if (cflag & CRTSCTS) { + if (cflag & CRTSCTS) arg |= DIGI_OUTPUT_FLOW_CONTROL_CTS; - } else { + else arg &= ~DIGI_OUTPUT_FLOW_CONTROL_CTS; - } buf[i++] = DIGI_CMD_SET_OUTPUT_FLOW_CONTROL; buf[i++] = priv->dp_port_num;