mxser: clean up tx handling in mxser_transmit_chars()

JIRA: https://issues.redhat.com/browse/RHEL-24205

commit 3b88dbff1c4e7d8a78e11773f19869c598552fcb
Author: Jiri Slaby <jirislaby@kernel.org>
Date:   Thu Nov 18 08:31:11 2021 +0100

    mxser: clean up tx handling in mxser_transmit_chars()

    The port->icount.tx is handled in a too complicated manner. Instead of
    remembering the original count and subtracting the new one from it,
    simply increase tx for each character in the loop. No need for cnt
    variable then.

    Change also the "X = X & Y" assignment to simpler "X &= Y".

    Signed-off-by: Jiri Slaby <jslaby@suse.cz>
    Link: https://lore.kernel.org/r/20211118073125.12283-6-jslaby@suse.cz
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
This commit is contained in:
Andrew Halaney 2024-02-21 11:15:20 -06:00 committed by Derek Barbosa
parent 031dfc04fc
commit 21e26af756
1 changed files with 3 additions and 5 deletions

View File

@ -1621,7 +1621,7 @@ static u8 mxser_receive_chars(struct tty_struct *tty,
static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port)
{
int count, cnt;
int count;
if (port->x_char) {
outb(port->x_char, port->ioaddr + UART_TX);
@ -1639,18 +1639,16 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port
return;
}
cnt = port->xmit_cnt;
count = port->xmit_fifo_size;
do {
outb(port->port.xmit_buf[port->xmit_tail++],
port->ioaddr + UART_TX);
port->xmit_tail = port->xmit_tail & (SERIAL_XMIT_SIZE - 1);
port->xmit_tail &= SERIAL_XMIT_SIZE - 1;
port->icount.tx++;
if (!--port->xmit_cnt)
break;
} while (--count > 0);
port->icount.tx += (cnt - port->xmit_cnt);
if (port->xmit_cnt < WAKEUP_CHARS)
tty_wakeup(tty);