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

serial: pch: simplify pop_tx() even more



1) take uart_tx_stopped into account every loop (the same as other uart
   drivers)
2) no need for 'count' variable, operate on 'size' directly

This allows inlining this into handle_tx() nicely in the next patch.

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


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 86252652
Loading
Loading
Loading
Loading
+5 −7
Original line number Original line Diff line number Diff line
@@ -759,21 +759,19 @@ static void pch_dma_tx_complete(void *arg)


static bool pop_tx(struct eg20t_port *priv, unsigned int size)
static bool pop_tx(struct eg20t_port *priv, unsigned int size)
{
{
	unsigned int count = 0;
	struct uart_port *port = &priv->port;
	struct uart_port *port = &priv->port;
	struct circ_buf *xmit = &port->state->xmit;
	struct circ_buf *xmit = &port->state->xmit;
	bool ret = false;


	if (uart_tx_stopped(port))
	while (!uart_tx_stopped(port) && !uart_circ_empty(xmit) && size) {
		return false;

	while (!uart_circ_empty(xmit) && count < size) {
		iowrite8(xmit->buf[xmit->tail], priv->membase + PCH_UART_THR);
		iowrite8(xmit->buf[xmit->tail], priv->membase + PCH_UART_THR);
		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
		port->icount.tx++;
		port->icount.tx++;
		count++;
		size--;
		ret = true;
	}
	}


	return count;
	return ret;
}
}


static int handle_rx_to(struct eg20t_port *priv)
static int handle_rx_to(struct eg20t_port *priv)