Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp333433rdh; Thu, 26 Oct 2023 03:42:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGmJISuQ8k6pa/prcjwfWiGSkDVSNJWhgTt8wqpM08E53cvL4DXgXYY+iSdG8vIlquZCw1F X-Received: by 2002:a25:ab4d:0:b0:da0:3c5a:e1bd with SMTP id u71-20020a25ab4d000000b00da03c5ae1bdmr7526607ybi.5.1698316938886; Thu, 26 Oct 2023 03:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698316938; cv=none; d=google.com; s=arc-20160816; b=C9Wqln/HLH8whx1Sw41SLBW/bNNAW6KT8xsUHmJAtNBej5H/4dUchDIY5VfpENnE7t EfVEKh1nTSY/qhc5TU5nxp01hFYUHOmgs5N4iY10FbLnAr6oKvCsV2t8UBG4mbVQB2mQ qsntrfvvuyDbmXyWt0zWoRlp4Yhv1Si1P9RA86l4pyCHc9W8tYh1hbxzjqmvM03wLQHi W1/J8OMVqnQp9L9blOh6FayzGtFtUxnrX6BTz3W5iwlQUrZ4GaSshoxc66fmf4kLp/fj j316vbpjgc1GSMZQeHS5PRPrsUvhN4bLkeeKcStbxA8XPZl2bwzh/Ds76nueUBb1MuxW n+8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=ZvItf+Q4uznFQkXp+ZifDN/od0IVBL9im+3wFy3ecg8=; fh=0GQDSxykeLgRwmrHkUZ9jyOse/Zvi+zOzBe9zh1Wo7Y=; b=uVdq8Z8iFL6tJx8kB0mF0qxixALH0QmgpIiWmUFcY4Kaf6rrLS69xA2nVxe37GIv7E 7yQ4pHfXsP84EPEbYmEbeOGgUna3p+migD5khqaqETEDqH+bc5qmfUchhFH3Z09Ceq9C SS6//yT7jqOqoPW7KsaDI6cf771SceEEo9pDe1sNZrC9lyD3gywbNu7mE3/jmXKCqGLo l0tl2OyCUIR1jR18ja88U0GE5nJlweJ8eoAT3VK4TkfQljhWps51b0JShK4eNwwT5S/6 0JgkPsG7gOFExclIK5gwc5TaJKuUyKas9agj1yLf15SF7rVj9JX8x4P92U9TCpDnyc/U gjyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="Dwu/4KiO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z4-20020a25ad84000000b00d8185415873si14095843ybi.489.2023.10.26.03.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 03:42:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="Dwu/4KiO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1A0B9821693A; Thu, 26 Oct 2023 03:42:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235045AbjJZKmL (ORCPT + 99 others); Thu, 26 Oct 2023 06:42:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231127AbjJZKl4 (ORCPT ); Thu, 26 Oct 2023 06:41:56 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2053A1A7; Thu, 26 Oct 2023 03:41:52 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 27F6024000A; Thu, 26 Oct 2023 10:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1698316911; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZvItf+Q4uznFQkXp+ZifDN/od0IVBL9im+3wFy3ecg8=; b=Dwu/4KiO+XbS+wEpdfzesTIjzNiAR4JzS7q9MbH+2JMAoNu7vrqPn/1Yty7XstKsDVV1TJ cjG9nk3zWoRw6HeaZCmv9Bs4fXjiaNyrZc+VB+/lI4i7ykqpUzQ+4e6FMkNGMNVc0L3bD8 FlDhc1WJx4Xcp9ywszAhvzq/MDqnt8I53SCpvn3KFaJvrdyU74R25WA84SY9VHmPsJPUwK N519PzPRt4IeEM77Btw9cOvmK5T3qYSlxB65KN/zMRZWeCtgg4FLTms1YctUa5sryYPV+d Y/aKPoqrXy0640gKL6dGPSSn7Zpl6tPVtj4dS3ZjwyDH9kj+50fJQEIBdk5kJQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 26 Oct 2023 12:41:22 +0200 Subject: [PATCH 5/6] tty: serial: amba-pl011: unindent pl011_console_get_options function body MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20231026-mbly-uart-v1-5-9258eea297d3@bootlin.com> References: <20231026-mbly-uart-v1-0-9258eea297d3@bootlin.com> In-Reply-To: <20231026-mbly-uart-v1-0-9258eea297d3@bootlin.com> To: Russell King , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Linus Walleij , Gregory CLEMENT , Alexandre Belloni , Thomas Petazzoni , Vladimir Kondratiev , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.12.3 X-GND-Sasl: theo.lebrun@bootlin.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 26 Oct 2023 03:42:17 -0700 (PDT) The whole function body is encapsulated inside an if-condition. Reverse the if logic and early return to remove one indentation level. Also turn two nested ifs into a single one at the end of the function. Signed-off-by: Théo Lebrun --- drivers/tty/serial/amba-pl011.c | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index bb3082c4d35c..5774d48c7f16 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2369,34 +2369,34 @@ pl011_console_write(struct console *co, const char *s, unsigned int count) static void pl011_console_get_options(struct uart_amba_port *uap, int *baud, int *parity, int *bits) { - if (pl011_read(uap, REG_CR) & UART01x_CR_UARTEN) { - unsigned int lcr_h, ibrd, fbrd; + unsigned int lcr_h, ibrd, fbrd; - lcr_h = pl011_read(uap, REG_LCRH_TX); + if (!(pl011_read(uap, REG_CR) & UART01x_CR_UARTEN)) + return; - *parity = 'n'; - if (lcr_h & UART01x_LCRH_PEN) { - if (lcr_h & UART01x_LCRH_EPS) - *parity = 'e'; - else - *parity = 'o'; - } + lcr_h = pl011_read(uap, REG_LCRH_TX); - if ((lcr_h & 0x60) == UART01x_LCRH_WLEN_7) - *bits = 7; + *parity = 'n'; + if (lcr_h & UART01x_LCRH_PEN) { + if (lcr_h & UART01x_LCRH_EPS) + *parity = 'e'; else - *bits = 8; + *parity = 'o'; + } + + if ((lcr_h & 0x60) == UART01x_LCRH_WLEN_7) + *bits = 7; + else + *bits = 8; - ibrd = pl011_read(uap, REG_IBRD); - fbrd = pl011_read(uap, REG_FBRD); + ibrd = pl011_read(uap, REG_IBRD); + fbrd = pl011_read(uap, REG_FBRD); - *baud = uap->port.uartclk * 4 / (64 * ibrd + fbrd); + *baud = uap->port.uartclk * 4 / (64 * ibrd + fbrd); - if (uap->vendor->oversampling) { - if (pl011_read(uap, REG_CR) - & ST_UART011_CR_OVSFACT) - *baud *= 2; - } + if (uap->vendor->oversampling && + (pl011_read(uap, REG_CR) & ST_UART011_CR_OVSFACT)) { + *baud *= 2; } } -- 2.41.0