From patchwork Thu Oct 26 10:41:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 738619 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44083C25B6F for ; Thu, 26 Oct 2023 10:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344692AbjJZKl7 (ORCPT ); Thu, 26 Oct 2023 06:41:59 -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 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 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 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 Reviewed-by: Linus Walleij --- 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; } }