Skip to content

Commit 754f680

Browse files
ij-intelgregkh
authored andcommitted
serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting
DMA complete & stop paths did not correctly account Tx'ed characters into icount.tx. Using uart_xmit_advance() fixes the problem. Fixes: e9ea096 ("serial: tegra: add serial driver") Cc: <stable@vger.kernel.org> # serial: Create uart_xmit_advance() Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20220901143934.8850-3-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e77cab7 commit 754f680

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/tty/serial/serial-tegra.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ static void tegra_uart_tx_dma_complete(void *args)
525525
count = tup->tx_bytes_requested - state.residue;
526526
async_tx_ack(tup->tx_dma_desc);
527527
spin_lock_irqsave(&tup->uport.lock, flags);
528-
xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
528+
uart_xmit_advance(&tup->uport, count);
529529
tup->tx_in_progress = 0;
530530
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
531531
uart_write_wakeup(&tup->uport);
@@ -613,7 +613,6 @@ static unsigned int tegra_uart_tx_empty(struct uart_port *u)
613613
static void tegra_uart_stop_tx(struct uart_port *u)
614614
{
615615
struct tegra_uart_port *tup = to_tegra_uport(u);
616-
struct circ_buf *xmit = &tup->uport.state->xmit;
617616
struct dma_tx_state state;
618617
unsigned int count;
619618

@@ -624,7 +623,7 @@ static void tegra_uart_stop_tx(struct uart_port *u)
624623
dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state);
625624
count = tup->tx_bytes_requested - state.residue;
626625
async_tx_ack(tup->tx_dma_desc);
627-
xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
626+
uart_xmit_advance(&tup->uport, count);
628627
tup->tx_in_progress = 0;
629628
}
630629

0 commit comments

Comments
 (0)