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;