From nobody Thu Dec 18 18:00:57 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 F32E1C54E76 for ; Mon, 20 Nov 2023 09:48:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232725AbjKTJs4 (ORCPT ); Mon, 20 Nov 2023 04:48:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232138AbjKTJsm (ORCPT ); Mon, 20 Nov 2023 04:48:42 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E316CD; Mon, 20 Nov 2023 01:48:38 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 6A4D62000F; Mon, 20 Nov 2023 09:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700473716; 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=Axpf3/ym3riiBLvwrKRQW22UpcQG/DDMdTP47PTMwFk=; b=dxFSKPK0gMc128alKfjCbtyy8R/198WYydgj5+1jn4bi6Qlc+eUfVII3rajGTiOyYR0EBJ 3OR6Bnp/SDnShGaoPtuZm1klpyNrirbCQPWh4fnEGcnyz+iItQAI9PsPevEoqZjMo4kRPq qOWBpFX78u0e1LB8UWpwM4AwLuJAmgd4cROEI4Ww5pj9qnNDRqfpY1fU7ROPT/EeRhJuz1 /+tVaOme+vnmUSsbXcBWwhuOzLApKfOljn37a+7XFOpjo2aZEXlf8KWsMrpYkDQAIxKbBj j2kzCX5dkEZaYwHTKOCPHDW7KzA2vIvLEizeAYG2DdRjLnd6v3rf4QTE2Bi/MQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Mon, 20 Nov 2023 10:48:28 +0100 Subject: [PATCH v3 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: quoted-printable Message-Id: <20231120-mbly-uart-v3-5-07ae35979f1f@bootlin.com> References: <20231120-mbly-uart-v3-0-07ae35979f1f@bootlin.com> In-Reply-To: <20231120-mbly-uart-v3-0-07ae35979f1f@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.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 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 cf9aefe2fd28..4185d6fd243b 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2369,35 +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'; + } =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.42.0