From nobody Tue Dec 30 12:59:45 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 19AE7C54FB9 for ; Thu, 16 Nov 2023 10:31:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345025AbjKPKbj (ORCPT ); Thu, 16 Nov 2023 05:31:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233066AbjKPKbb (ORCPT ); Thu, 16 Nov 2023 05:31:31 -0500 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B846D1AE; Thu, 16 Nov 2023 02:31:26 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id DEF996001C; Thu, 16 Nov 2023 10:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700130685; 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=8Gilx4H3RKP8/lZDTxCW04nyKKjKNCSF+csRLPdNS2A=; b=JGs2E4Pm4ttEACnrdJLtXtseCSq4ZCZOGkeVwb0XK7HwE5wEyzJYbuUSED/lJJXzwU5+Jz aydtnjt7I4CmF/JEs83zg0J0OL7YFkQCtUOpViTQP640eIQmc80KockT651UVFfChIaBEx bWqZRjnMXbL4C6siWB88VN3om1jpFOnm16vCvWIuHcIWrLYzIydBY3eG5P1/4fgwTZ0rsU YguJIdOi87LeLchXoAYe556YcEtxiu1cSItiTjOakmvbo2gOT1G6VEZ19sjGs6PDSDIOOy S0F7f6gzyez5k2vVXdB8rMs+LPBa2XcIrsa40K0bdNc6PF8IaPR/kQvNFQyL8w== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 16 Nov 2023 11:31:08 +0100 Subject: [PATCH v2 5/5] 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: <20231116-mbly-uart-v2-5-863f665ce520@bootlin.com> References: <20231116-mbly-uart-v2-0-863f665ce520@bootlin.com> In-Reply-To: <20231116-mbly-uart-v2-0-863f665ce520@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?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-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 Signed-off-by: Th=C3=A9o 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-pl01= 1.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 *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'; + } + + if ((lcr_h & 0x60) =3D=3D UART01x_LCRH_WLEN_7) + *bits =3D 7; + else + *bits =3D 8; =20 - ibrd =3D pl011_read(uap, REG_IBRD); - fbrd =3D pl011_read(uap, REG_FBRD); + ibrd =3D pl011_read(uap, REG_IBRD); + fbrd =3D pl011_read(uap, REG_FBRD); =20 - *baud =3D uap->port.uartclk * 4 / (64 * ibrd + fbrd); + *baud =3D uap->port.uartclk * 4 / (64 * ibrd + fbrd); =20 - if (uap->vendor->oversampling) { - if (pl011_read(uap, REG_CR) - & ST_UART011_CR_OVSFACT) - *baud *=3D 2; - } + if (uap->vendor->oversampling && + (pl011_read(uap, REG_CR) & ST_UART011_CR_OVSFACT)) { + *baud *=3D 2; } } =20 --=20 2.41.0