diff mbox series

[28/44] serial: samsung_tty: Use uart_xmit_advance()

Message ID 20221019091151.6692-29-ilpo.jarvinen@linux.intel.com
State New
Headers show
Series None | expand

Commit Message

Ilpo Järvinen Oct. 19, 2022, 9:11 a.m. UTC
Take advantage of the new uart_xmit_advance() helper.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/tty/serial/samsung_tty.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Sam Protsenko Oct. 21, 2022, 11:48 a.m. UTC | #1
On Wed, 19 Oct 2022 at 11:35, Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
>
> Take advantage of the new uart_xmit_advance() helper.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

>  drivers/tty/serial/samsung_tty.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
> index 77d1363029f5..7e34361a1085 100644
> --- a/drivers/tty/serial/samsung_tty.c
> +++ b/drivers/tty/serial/samsung_tty.c
> @@ -288,7 +288,6 @@ static void s3c24xx_serial_stop_tx(struct uart_port *port)
>  {
>         struct s3c24xx_uart_port *ourport = to_ourport(port);
>         struct s3c24xx_uart_dma *dma = ourport->dma;
> -       struct circ_buf *xmit = &port->state->xmit;
>         struct dma_tx_state state;
>         int count;
>
> @@ -316,8 +315,7 @@ static void s3c24xx_serial_stop_tx(struct uart_port *port)
>                                         DMA_TO_DEVICE);
>                 async_tx_ack(dma->tx_desc);
>                 count = dma->tx_bytes_requested - state.residue;
> -               xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
> -               port->icount.tx += count;
> +               uart_xmit_advance(port, count);
>         }
>
>         ourport->tx_enabled = 0;
> @@ -351,8 +349,7 @@ static void s3c24xx_serial_tx_dma_complete(void *args)
>
>         spin_lock_irqsave(&port->lock, flags);
>
> -       xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
> -       port->icount.tx += count;
> +       uart_xmit_advance(port, count);
>         ourport->tx_in_progress = 0;
>
>         if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
> @@ -916,8 +913,7 @@ static void s3c24xx_serial_tx_chars(struct s3c24xx_uart_port *ourport)
>                         break;
>
>                 wr_reg(port, S3C2410_UTXH, xmit->buf[xmit->tail]);
> -               xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
> -               port->icount.tx++;
> +               uart_xmit_advance(port, 1);
>                 count--;
>         }
>
> --
> 2.30.2
>
diff mbox series

Patch

diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
index 77d1363029f5..7e34361a1085 100644
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -288,7 +288,6 @@  static void s3c24xx_serial_stop_tx(struct uart_port *port)
 {
 	struct s3c24xx_uart_port *ourport = to_ourport(port);
 	struct s3c24xx_uart_dma *dma = ourport->dma;
-	struct circ_buf *xmit = &port->state->xmit;
 	struct dma_tx_state state;
 	int count;
 
@@ -316,8 +315,7 @@  static void s3c24xx_serial_stop_tx(struct uart_port *port)
 					DMA_TO_DEVICE);
 		async_tx_ack(dma->tx_desc);
 		count = dma->tx_bytes_requested - state.residue;
-		xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
-		port->icount.tx += count;
+		uart_xmit_advance(port, count);
 	}
 
 	ourport->tx_enabled = 0;
@@ -351,8 +349,7 @@  static void s3c24xx_serial_tx_dma_complete(void *args)
 
 	spin_lock_irqsave(&port->lock, flags);
 
-	xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
-	port->icount.tx += count;
+	uart_xmit_advance(port, count);
 	ourport->tx_in_progress = 0;
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
@@ -916,8 +913,7 @@  static void s3c24xx_serial_tx_chars(struct s3c24xx_uart_port *ourport)
 			break;
 
 		wr_reg(port, S3C2410_UTXH, xmit->buf[xmit->tail]);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 		count--;
 	}