serial: stm32: Use uart_xmit_advance()
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Wed, 19 Oct 2022 09:11:41 +0000 (12:11 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Nov 2022 02:35:42 +0000 (03:35 +0100)
Take advantage of the new uart_xmit_advance() helper.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20221019091151.6692-35-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/stm32-usart.c

index dfdbcf0..24def72 100644 (file)
@@ -596,8 +596,7 @@ static void stm32_usart_transmit_chars_pio(struct uart_port *port)
                if (!(readl_relaxed(port->membase + ofs->isr) & USART_SR_TXE))
                        break;
                writel_relaxed(xmit->buf[xmit->tail], port->membase + ofs->tdr);
-               xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-               port->icount.tx++;
+               uart_xmit_advance(port, 1);
        }
 
        /* rely on TXE irq (mask or unmask) for sending remaining data */
@@ -673,8 +672,8 @@ static void stm32_usart_transmit_chars_dma(struct uart_port *port)
 
        stm32_usart_set_bits(port, ofs->cr3, USART_CR3_DMAT);
 
-       xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
-       port->icount.tx += count;
+       uart_xmit_advance(port, count);
+
        return;
 
 fallback_err: