serial: max310x: move variables to while() scope

txlen, to_send and tail variables are only used within the while() loop.

Move them to that scope to keep them closer to their usage and improve
readability.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://patch.msgid.link/20260417-max310x-2-v1-9-b424e105ecac@dimonoff.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Hugo Villeneuve 2026-04-17 10:53:36 -04:00 committed by Greg Kroah-Hartman
parent 20ffe4b333
commit 922cc077b2

View File

@ -761,8 +761,6 @@ static void max310x_handle_rx(struct uart_port *port, unsigned int rxlen)
static void max310x_handle_tx(struct uart_port *port)
{
struct tty_port *tport = &port->state->port;
unsigned int txlen, to_send;
unsigned char *tail;
if (unlikely(port->x_char)) {
max310x_port_write(port, MAX310X_THR_REG, port->x_char);
@ -779,6 +777,9 @@ static void max310x_handle_tx(struct uart_port *port)
* We could do that in one SPI transaction, but meh.
*/
while (!kfifo_is_empty(&tport->xmit_fifo)) {
unsigned int txlen, to_send;
unsigned char *tail;
/* Limit to space available in TX FIFO */
txlen = max310x_port_read(port, MAX310X_TXFIFOLVL_REG);
txlen = port->fifosize - txlen;