lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220503080808.28332-5-jslaby@suse.cz>
Date:   Tue,  3 May 2022 10:08:07 +0200
From:   Jiri Slaby <jslaby@...e.cz>
To:     gregkh@...uxfoundation.org
Cc:     linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH 6/7] 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: Jiri Slaby <jslaby@...e.cz>
---
 drivers/tty/serial/pch_uart.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index ae1d6b641253..e1eadf519089 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -759,21 +759,19 @@ static void pch_dma_tx_complete(void *arg)
 
 static bool pop_tx(struct eg20t_port *priv, unsigned int size)
 {
-	unsigned int count = 0;
 	struct uart_port *port = &priv->port;
 	struct circ_buf *xmit = &port->state->xmit;
+	bool ret = false;
 
-	if (uart_tx_stopped(port))
-		return false;
-
-	while (!uart_circ_empty(xmit) && count < size) {
+	while (!uart_tx_stopped(port) && !uart_circ_empty(xmit) && size) {
 		iowrite8(xmit->buf[xmit->tail], priv->membase + PCH_UART_THR);
 		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
 		port->icount.tx++;
-		count++;
+		size--;
+		ret = true;
 	}
 
-	return count;
+	return ret;
 }
 
 static int handle_rx_to(struct eg20t_port *priv)
-- 
2.36.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ