Commit 8ff87406 authored by Théo Lebrun's avatar Théo Lebrun Committed by Greg Kroah-Hartman
Browse files

tty: serial: amba-pl011: unindent pl011_console_get_options function body



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: default avatarLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarThéo Lebrun <theo.lebrun@bootlin.com>
Link: https://lore.kernel.org/r/20231207-mbly-uart-v6-7-e384afa5e78c@bootlin.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 826bd77a
Loading
Loading
Loading
Loading
+21 −22
Original line number Diff line number Diff line
@@ -2363,9 +2363,11 @@ 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;

	if (!(pl011_read(uap, REG_CR) & UART01x_CR_UARTEN))
		return;

	lcr_h = pl011_read(uap, REG_LCRH_TX);

	*parity = 'n';
@@ -2386,13 +2388,10 @@ static void pl011_console_get_options(struct uart_amba_port *uap, int *baud,

	*baud = uap->port.uartclk * 4 / (64 * ibrd + fbrd);

		if (uap->vendor->oversampling) {
			if (pl011_read(uap, REG_CR)
				  & ST_UART011_CR_OVSFACT)
	if (uap->vendor->oversampling &&
	    (pl011_read(uap, REG_CR) & ST_UART011_CR_OVSFACT))
		*baud *= 2;
}
	}
}

static int pl011_console_setup(struct console *co, char *options)
{