Commit a28ef758 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

serial: xilinx_uartps: return early in cdns_uart_handle_tx()



Return from the true branch of the 'if'. This saves one indentation
level and makes the code more readable.

The two comments about what obvious code does are removed too.

Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220421101708.5640-3-jslaby@suse.cz


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b68f42d4
Loading
Loading
Loading
Loading
+18 −29
Original line number Diff line number Diff line
@@ -317,38 +317,27 @@ static void cdns_uart_handle_tx(void *dev_id)

	if (uart_circ_empty(&port->state->xmit)) {
		writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_IDR);
	} else {
		return;
	}

	numbytes = port->fifosize;
	while (numbytes && !uart_circ_empty(&port->state->xmit) &&
	       !(readl(port->membase + CDNS_UART_SR) &
					CDNS_UART_SR_TXFULL)) {
			/*
			 * Get the data from the UART circular buffer
			 * and write it to the cdns_uart's TX_FIFO
			 * register.
			 */
			writel(
				port->state->xmit.buf[port->state->xmit.tail],

		writel(port->state->xmit.buf[port->state->xmit.tail],
				port->membase + CDNS_UART_FIFO);

		port->icount.tx++;

			/*
			 * Adjust the tail of the UART buffer and wrap
			 * the buffer if it reaches limit.
			 */
			port->state->xmit.tail =
				(port->state->xmit.tail + 1) &
		port->state->xmit.tail = (port->state->xmit.tail + 1) &
				(UART_XMIT_SIZE - 1);

		numbytes--;
	}

		if (uart_circ_chars_pending(
				&port->state->xmit) < WAKEUP_CHARS)
	if (uart_circ_chars_pending(&port->state->xmit) < WAKEUP_CHARS)
		uart_write_wakeup(port);
}
}

/**
 * cdns_uart_isr - Interrupt handler