From nobody Tue Dec 16 23:56:58 2025 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 31350C4167B for ; Thu, 7 Dec 2023 17:56:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443625AbjLGR4s (ORCPT ); Thu, 7 Dec 2023 12:56:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235231AbjLGR4n (ORCPT ); Thu, 7 Dec 2023 12:56:43 -0500 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B62B170E; Thu, 7 Dec 2023 09:56:36 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id C8B73E000D; Thu, 7 Dec 2023 17:56:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701971795; 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=jhHwMPKMhE6XsTNOR4sdwWV4X+Iddbs0ASEj4p1owTs=; b=iRXNpubyMa1hzA29zjFEdXwTtAN0FRlflcZxlzrXaLNY7pf/kDLoVh6QZS6lpGxNyHGrl0 T/PtkXC0h0OfGRz6oWIbncAuZuf4be9uY53cSwl990vFoVjwK7F/VrOk2jO0MHSbIRZyTa qk3Q2kVGLal8beIroZP1wMdyl4jv07kPsc5J+ZsMGxhwN8q8FtkR9i/IoOVn0WhO/XSDOK l959I9D8iM82r3CkhXmwhS/BnB+eAt2oI1K6cVma4X3V7VwQHZ2p+b5+nSrSY9iPOpTn5l PdZ+luWlWOSgzNFfQWlE0LSsV3j9tWUgaMgaCVOcPT03FuWC7qiv6nPdkuh3/A== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 07 Dec 2023 18:56:12 +0100 Subject: [PATCH v6 7/8] 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: quoted-printable Message-Id: <20231207-mbly-uart-v6-7-e384afa5e78c@bootlin.com> References: <20231207-mbly-uart-v6-0-e384afa5e78c@bootlin.com> In-Reply-To: <20231207-mbly-uart-v6-0-e384afa5e78c@bootlin.com> To: Russell King , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Linus Walleij , =?utf-8?q?Gr=C3=A9gory_Clement?= , Alexandre Belloni , Thomas Petazzoni , Vladimir Kondratiev , Tawfik Bayouk , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.12.4 X-GND-Sasl: theo.lebrun@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. Reviewed-by: Linus Walleij Reviewed-by: Ilpo J=C3=A4rvinen Signed-off-by: Th=C3=A9o Lebrun --- drivers/tty/serial/amba-pl011.c | 43 ++++++++++++++++++++-----------------= ---- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl01= 1.c index d141af8f8a5f..fe910c5f3489 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2363,35 +2363,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 *bau= d, 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; =20 - lcr_h =3D pl011_read(uap, REG_LCRH_TX); + if (!(pl011_read(uap, REG_CR) & UART01x_CR_UARTEN)) + return; =20 - *parity =3D 'n'; - if (lcr_h & UART01x_LCRH_PEN) { - if (lcr_h & UART01x_LCRH_EPS) - *parity =3D 'e'; - else - *parity =3D 'o'; - } + lcr_h =3D pl011_read(uap, REG_LCRH_TX); =20 - if ((lcr_h & 0x60) =3D=3D UART01x_LCRH_WLEN_7) - *bits =3D 7; + *parity =3D 'n'; + if (lcr_h & UART01x_LCRH_PEN) { + if (lcr_h & UART01x_LCRH_EPS) + *parity =3D 'e'; else - *bits =3D 8; + *parity =3D 'o'; + } =20 - ibrd =3D pl011_read(uap, REG_IBRD); - fbrd =3D pl011_read(uap, REG_FBRD); + if ((lcr_h & 0x60) =3D=3D UART01x_LCRH_WLEN_7) + *bits =3D 7; + else + *bits =3D 8; =20 - *baud =3D uap->port.uartclk * 4 / (64 * ibrd + fbrd); + ibrd =3D pl011_read(uap, REG_IBRD); + fbrd =3D pl011_read(uap, REG_FBRD); =20 - if (uap->vendor->oversampling) { - if (pl011_read(uap, REG_CR) - & ST_UART011_CR_OVSFACT) - *baud *=3D 2; - } - } + *baud =3D uap->port.uartclk * 4 / (64 * ibrd + fbrd); + + if (uap->vendor->oversampling && + (pl011_read(uap, REG_CR) & ST_UART011_CR_OVSFACT)) + *baud *=3D 2; } =20 static int pl011_console_setup(struct console *co, char *options) --=20 2.43.0