linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance()
@ 2022-10-19  9:11 Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 01/44] serial: dz: Use uart_xmit_advance() Ilpo Järvinen
                   ` (44 more replies)
  0 siblings, 45 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby
  Cc: linux-kernel, Andy Shevchenko, Ilpo Järvinen

The uart_xmit_advance() helper was created for managing the xmit tail
index and accounting. It simplifies one the most common operation in
almost every serial driver. Convert most of the drivers to use the new
helper.

I've tried to pick the drivers such that these shouldn't collide with
the ones Jiri's tx loop rewrite series is touching (unless he has
something hidden beyond what has been on the list).

Ilpo Järvinen (44):
  serial: dz: Use uart_xmit_advance()
  serial: men_z135_uart: Use uart_xmit_advance()
  serial: msm: Use uart_xmit_advance()
  serial: pch_uart: Use uart_xmit_advance()
  serial: sc16is7xx: Use uart_xmit_advance()
  serial: 8250_bcm7271: Use uart_xmit_advance()
  serial: 8250: Use uart_xmit_advance()
  serial: pl011: Use uart_xmit_advance()
  serial: ar933x: Use uart_xmit_advance()
  serial: arc: Use uart_xmit_advance()
  serial: atmel: Use uart_xmit_advance()
  serial: clps711x: Use uart_xmit_advance()
  serial: cpm_uart: Use uart_xmit_advance()
  serial: digicolor: Use uart_xmit_advance()
  serial: linflexuart: Use uart_xmit_advance()
  serial: fsl_lpuart: Use uart_xmit_advance()
  serial: imx: Use uart_xmit_advance()
  serial: ip22zilog: Use uart_xmit_advance()
  serial: liteuart: Use uart_xmit_advance()
  serial: max3100: Use uart_xmit_advance()
  serial: max310x: Use uart_xmit_advance()
  serial: meson: Use uart_xmit_advance()
  serial: milbeaut_usio: Use uart_xmit_advance()
  serial: mvebu-uart: Use uart_xmit_advance()
  serial: pic32: Use uart_xmit_advance()
  serial: pmac_zilog: Use uart_xmit_advance()
  serial: rda: Use uart_xmit_advance()
  serial: samsung_tty: Use uart_xmit_advance()
  serial: sb1250-duart: Use uart_xmit_advance()
  serial: sccnxp: Use uart_xmit_advance()
  serial: tegra: Use uart_xmit_advance()
  serial: sh-sci: Use uart_xmit_advance()
  serial: sprd: Use uart_xmit_advance()
  serial: stm32: Use uart_xmit_advance()
  serial: sunhv: Use uart_xmit_advance()
  serial: sunplus-uart: Use uart_xmit_advance()
  serial: sunsab: Use uart_xmit_advance()
  serial: sunsu: Use uart_xmit_advance()
  serial: sunzilog: Use uart_xmit_advance()
  serial: timbuart: Use uart_xmit_advance()
  serial: uartlite: Use uart_xmit_advance()
  serial: ucc_uart: Use uart_xmit_advance()
  serial: xuartps: Use uart_xmit_advance()
  serial: zs: Use uart_xmit_advance()

 drivers/tty/serial/8250/8250_bcm7271.c      |  4 +---
 drivers/tty/serial/8250/8250_port.c         |  3 +--
 drivers/tty/serial/amba-pl011.c             |  3 +--
 drivers/tty/serial/ar933x_uart.c            |  3 +--
 drivers/tty/serial/arc_uart.c               |  3 +--
 drivers/tty/serial/atmel_serial.c           | 11 ++---------
 drivers/tty/serial/clps711x.c               |  3 +--
 drivers/tty/serial/cpm_uart/cpm_uart_core.c |  3 +--
 drivers/tty/serial/digicolor-usart.c        |  3 +--
 drivers/tty/serial/dz.c                     |  3 +--
 drivers/tty/serial/fsl_linflexuart.c        |  3 +--
 drivers/tty/serial/fsl_lpuart.c             |  7 ++-----
 drivers/tty/serial/imx.c                    |  7 ++-----
 drivers/tty/serial/ip22zilog.c              |  6 ++----
 drivers/tty/serial/liteuart.c               |  3 +--
 drivers/tty/serial/max3100.c                |  4 +---
 drivers/tty/serial/max310x.c                |  5 +----
 drivers/tty/serial/men_z135_uart.c          |  5 +----
 drivers/tty/serial/meson_uart.c             |  3 +--
 drivers/tty/serial/milbeaut_usio.c          |  3 +--
 drivers/tty/serial/msm_serial.c             | 11 +++--------
 drivers/tty/serial/mvebu-uart.c             |  3 +--
 drivers/tty/serial/pch_uart.c               | 12 ++++--------
 drivers/tty/serial/pic32_uart.c             |  3 +--
 drivers/tty/serial/pmac_zilog.c             |  6 ++----
 drivers/tty/serial/rda-uart.c               |  3 +--
 drivers/tty/serial/samsung_tty.c            | 10 +++-------
 drivers/tty/serial/sb1250-duart.c           |  3 +--
 drivers/tty/serial/sc16is7xx.c              |  5 +----
 drivers/tty/serial/sccnxp.c                 |  3 +--
 drivers/tty/serial/serial-tegra.c           |  3 +--
 drivers/tty/serial/sh-sci.c                 |  5 +----
 drivers/tty/serial/sprd_serial.c            |  7 ++-----
 drivers/tty/serial/stm32-usart.c            |  7 +++----
 drivers/tty/serial/sunhv.c                  |  6 ++----
 drivers/tty/serial/sunplus-uart.c           |  4 +---
 drivers/tty/serial/sunsab.c                 |  6 ++----
 drivers/tty/serial/sunsu.c                  |  3 +--
 drivers/tty/serial/sunzilog.c               |  6 ++----
 drivers/tty/serial/timbuart.c               |  3 +--
 drivers/tty/serial/uartlite.c               |  3 +--
 drivers/tty/serial/ucc_uart.c               |  3 +--
 drivers/tty/serial/xilinx_uartps.c          |  4 +---
 drivers/tty/serial/zs.c                     |  3 +--
 44 files changed, 62 insertions(+), 145 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 01/44] serial: dz: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 02/44] serial: men_z135_uart: " Ilpo Järvinen
                   ` (43 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Maciej W. Rozycki, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c
index 829b452daee9..6b7ed7f2f3ca 100644
--- a/drivers/tty/serial/dz.c
+++ b/drivers/tty/serial/dz.c
@@ -279,9 +279,8 @@ static inline void dz_transmit_chars(struct dz_mux *mux)
 	 * so we go one char at a time) :-<
 	 */
 	tmp = xmit->buf[xmit->tail];
-	xmit->tail = (xmit->tail + 1) & (DZ_XMIT_SIZE - 1);
 	dz_out(dport, DZ_TDR, tmp);
-	dport->port.icount.tx++;
+	uart_xmit_advance(&dport->port, 1);
 
 	if (uart_circ_chars_pending(xmit) < DZ_WAKEUP_CHARS)
 		uart_write_wakeup(&dport->port);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 02/44] serial: men_z135_uart: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 01/44] serial: dz: Use uart_xmit_advance() Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 03/44] serial: msm: " Ilpo Järvinen
                   ` (42 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/tty/serial/men_z135_uart.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/tty/serial/men_z135_uart.c b/drivers/tty/serial/men_z135_uart.c
index 3690f5cf0f43..d2502aaa3e8c 100644
--- a/drivers/tty/serial/men_z135_uart.c
+++ b/drivers/tty/serial/men_z135_uart.c
@@ -352,11 +352,8 @@ static void men_z135_handle_tx(struct men_z135_port *uart)
 	n = min(n, s);
 
 	memcpy_toio(port->membase + MEN_Z135_TX_RAM, &xmit->buf[xmit->tail], n);
-	xmit->tail = (xmit->tail + n) & (UART_XMIT_SIZE - 1);
-
 	iowrite32(n & 0x3ff, port->membase + MEN_Z135_TX_CTRL);
-
-	port->icount.tx += n;
+	uart_xmit_advance(port, n);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(port);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 03/44] serial: msm: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 01/44] serial: dz: Use uart_xmit_advance() Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 02/44] serial: men_z135_uart: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 04/44] serial: pch_uart: " Ilpo Järvinen
                   ` (41 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, linux-arm-msm, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index 7dd19a281579..2b2e0f74b75a 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -464,12 +464,9 @@ static void msm_complete_tx_dma(void *args)
 	}
 
 	count = dma->count - state.residue;
-	port->icount.tx += count;
+	uart_xmit_advance(port, count);
 	dma->count = 0;
 
-	xmit->tail += count;
-	xmit->tail &= UART_XMIT_SIZE - 1;
-
 	/* Restore "Tx FIFO below watermark" interrupt */
 	msm_port->imr |= MSM_UART_IMR_TXLEV;
 	msm_write(port, msm_port->imr, MSM_UART_IMR);
@@ -866,13 +863,11 @@ static void msm_handle_tx_pio(struct uart_port *port, unsigned int tx_count)
 		else
 			num_chars = 1;
 
-		for (i = 0; i < num_chars; i++) {
+		for (i = 0; i < num_chars; i++)
 			buf[i] = xmit->buf[xmit->tail + i];
-			port->icount.tx++;
-		}
 
 		iowrite32_rep(tf, buf, 1);
-		xmit->tail = (xmit->tail + num_chars) & (UART_XMIT_SIZE - 1);
+		uart_xmit_advance(port, num_chars);
 		tf_pointer += num_chars;
 	}
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 04/44] serial: pch_uart: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (2 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 03/44] serial: msm: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19 11:11   ` Andy Shevchenko
  2022-10-19  9:11 ` [PATCH 05/44] serial: sc16is7xx: " Ilpo Järvinen
                   ` (40 subsequent siblings)
  44 siblings, 1 reply; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index c59ce7886579..c76719c0f453 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -738,15 +738,12 @@ static void pch_dma_tx_complete(void *arg)
 {
 	struct eg20t_port *priv = arg;
 	struct uart_port *port = &priv->port;
-	struct circ_buf *xmit = &port->state->xmit;
 	struct scatterlist *sg = priv->sg_tx_p;
 	int i;
 
-	for (i = 0; i < priv->nent; i++, sg++) {
-		xmit->tail += sg_dma_len(sg);
-		port->icount.tx += sg_dma_len(sg);
-	}
-	xmit->tail &= UART_XMIT_SIZE - 1;
+	for (i = 0; i < priv->nent; i++, sg++)
+		uart_xmit_advance(port, sg_dma_len(sg));
+
 	async_tx_ack(priv->desc_tx);
 	dma_unmap_sg(port->dev, sg, priv->orig_nent, DMA_TO_DEVICE);
 	priv->tx_dma_use = 0;
@@ -843,8 +840,7 @@ static unsigned int handle_tx(struct eg20t_port *priv)
 
 	while (!uart_tx_stopped(port) && !uart_circ_empty(xmit) && fifo_size) {
 		iowrite8(xmit->buf[xmit->tail], priv->membase + PCH_UART_THR);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 		fifo_size--;
 		tx_empty = 0;
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 05/44] serial: sc16is7xx: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (3 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 04/44] serial: pch_uart: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19 11:11   ` Andy Shevchenko
  2022-10-19  9:11 ` [PATCH 06/44] serial: 8250_bcm7271: " Ilpo Järvinen
                   ` (39 subsequent siblings)
  44 siblings, 1 reply; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/tty/serial/sc16is7xx.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 524921360ca7..39f92eb1e698 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -686,13 +686,10 @@ static void sc16is7xx_handle_tx(struct uart_port *port)
 		}
 		to_send = (to_send > txlen) ? txlen : to_send;
 
-		/* Add data to send */
-		port->icount.tx += to_send;
-
 		/* Convert to linear buffer */
 		for (i = 0; i < to_send; ++i) {
 			s->buf[i] = xmit->buf[xmit->tail];
-			xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
+			uart_xmit_advance(port, 1);
 		}
 
 		sc16is7xx_fifo_write(port, to_send);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 06/44] serial: 8250_bcm7271: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (4 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 05/44] serial: sc16is7xx: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 07/44] serial: 8250: " Ilpo Järvinen
                   ` (38 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Al Cooper,
	Broadcom internal kernel review list, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c
index fa8ccf204d86..062177b64d21 100644
--- a/drivers/tty/serial/8250/8250_bcm7271.c
+++ b/drivers/tty/serial/8250/8250_bcm7271.c
@@ -425,9 +425,7 @@ static int brcmuart_tx_dma(struct uart_8250_port *p)
 
 	priv->dma.tx_err = 0;
 	memcpy(priv->tx_buf, &xmit->buf[xmit->tail], tx_size);
-	xmit->tail += tx_size;
-	xmit->tail &= UART_XMIT_SIZE - 1;
-	p->port.icount.tx += tx_size;
+	uart_xmit_advance(&p->port, tx_size);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(&p->port);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 07/44] serial: 8250: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (5 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 06/44] serial: 8250_bcm7271: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19 11:12   ` Andy Shevchenko
  2022-10-19  9:11 ` [PATCH 08/44] serial: pl011: " Ilpo Järvinen
                   ` (37 subsequent siblings)
  44 siblings, 1 reply; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index fe8662cd9402..b94e60e75326 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1842,8 +1842,7 @@ void serial8250_tx_chars(struct uart_8250_port *up)
 			 */
 			serial_in(up, UART_SCR);
 		}
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 		if (uart_circ_empty(xmit))
 			break;
 		if ((up->capabilities & UART_CAP_HFIFO) &&
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 08/44] serial: pl011: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (6 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 07/44] serial: 8250: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 09/44] serial: ar933x: " Ilpo Järvinen
                   ` (36 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Russell King, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 5cdced39eafd..6d8552506091 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -677,8 +677,7 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap)
 	 * Now we know that DMA will fire, so advance the ring buffer
 	 * with the stuff we just dispatched.
 	 */
-	xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
-	uap->port.icount.tx += count;
+	uart_xmit_advance(&uap->port, count);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(&uap->port);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 09/44] serial: ar933x: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (7 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 08/44] serial: pl011: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 10/44] serial: arc: " Ilpo Järvinen
                   ` (35 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c
index 925484a42c82..4c3d04c6826a 100644
--- a/drivers/tty/serial/ar933x_uart.c
+++ b/drivers/tty/serial/ar933x_uart.c
@@ -425,8 +425,7 @@ static void ar933x_uart_tx_chars(struct ar933x_uart_port *up)
 
 		ar933x_uart_putc(up, xmit->buf[xmit->tail]);
 
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		up->port.icount.tx++;
+		uart_xmit_advance(&up->port, 1);
 	} while (--count > 0);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 10/44] serial: arc: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (8 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 09/44] serial: ar933x: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 11/44] serial: atmel: " Ilpo Järvinen
                   ` (34 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Vineet Gupta, linux-snps-arc,
	linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 2a65ea2660e1..748e8b1cf4f7 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -166,8 +166,7 @@ static void arc_serial_tx_chars(struct uart_port *port)
 		sent = 1;
 	} else if (!uart_circ_empty(xmit)) {
 		ch = xmit->buf[xmit->tail];
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 		while (!(UART_GET_STATUS(port) & TXEMPTY))
 			cpu_relax();
 		UART_SET_DATA(port, ch);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 11/44] serial: atmel: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (9 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 10/44] serial: arc: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-20  9:01   ` Claudiu.Beznea
  2022-10-19  9:11 ` [PATCH 12/44] serial: clps711x: " Ilpo Järvinen
                   ` (33 subsequent siblings)
  44 siblings, 1 reply; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Richard Genoud, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, linux-arm-kernel,
	linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index bd07f79a2df9..4485f2d26b77 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -875,10 +875,7 @@ static void atmel_complete_tx_dma(void *arg)
 
 	if (chan)
 		dmaengine_terminate_all(chan);
-	xmit->tail += atmel_port->tx_len;
-	xmit->tail &= UART_XMIT_SIZE - 1;
-
-	port->icount.tx += atmel_port->tx_len;
+	uart_xmit_advance(port, atmel_port->tx_len);
 
 	spin_lock_irq(&atmel_port->lock_tx);
 	async_tx_ack(atmel_port->desc_tx);
@@ -1471,11 +1468,7 @@ static void atmel_tx_pdc(struct uart_port *port)
 	/* nothing left to transmit? */
 	if (atmel_uart_readl(port, ATMEL_PDC_TCR))
 		return;
-
-	xmit->tail += pdc->ofs;
-	xmit->tail &= UART_XMIT_SIZE - 1;
-
-	port->icount.tx += pdc->ofs;
+	uart_xmit_advance(port, pdc->ofs);
 	pdc->ofs = 0;
 
 	/* more to transmit - setup next transfer */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 12/44] serial: clps711x: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (10 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 11/44] serial: atmel: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 13/44] serial: cpm_uart: " Ilpo Järvinen
                   ` (32 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Alexander Shiyan,
	linux-arm-kernel, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c
index 404b43a5ae33..e190dce58f46 100644
--- a/drivers/tty/serial/clps711x.c
+++ b/drivers/tty/serial/clps711x.c
@@ -166,8 +166,7 @@ static irqreturn_t uart_clps711x_int_tx(int irq, void *dev_id)
 		u32 sysflg = 0;
 
 		writew(xmit->buf[xmit->tail], port->membase + UARTDR_OFFSET);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 
 		regmap_read(s->syscon, SYSFLG_OFFSET, &sysflg);
 		if (sysflg & SYSFLG_UTXFF)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 13/44] serial: cpm_uart: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (11 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 12/44] serial: clps711x: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 14/44] serial: digicolor: " Ilpo Järvinen
                   ` (31 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
index b4369ed45ae2..5565f302cb21 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
@@ -684,8 +684,7 @@ static int cpm_uart_tx_pump(struct uart_port *port)
 		p = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr), pinfo);
 		while (count < pinfo->tx_fifosize) {
 			*p++ = xmit->buf[xmit->tail];
-			xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-			port->icount.tx++;
+			uart_xmit_advance(port, 1);
 			count++;
 			if (xmit->head == xmit->tail)
 				break;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 14/44] serial: digicolor: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (12 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 13/44] serial: cpm_uart: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19 11:30   ` Baruch Siach
  2022-10-19  9:11 ` [PATCH 15/44] serial: linflexuart: " Ilpo Järvinen
                   ` (30 subsequent siblings)
  44 siblings, 1 reply; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Baruch Siach,
	linux-arm-kernel, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/digicolor-usart.c b/drivers/tty/serial/digicolor-usart.c
index 0c0a62346f23..ed197705f7ee 100644
--- a/drivers/tty/serial/digicolor-usart.c
+++ b/drivers/tty/serial/digicolor-usart.c
@@ -202,8 +202,7 @@ static void digicolor_uart_tx(struct uart_port *port)
 
 	while (!uart_circ_empty(xmit)) {
 		writeb(xmit->buf[xmit->tail], port->membase + UA_EMI_REC);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 
 		if (digicolor_uart_tx_full(port))
 			break;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 15/44] serial: linflexuart: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (13 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 14/44] serial: digicolor: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 16/44] serial: fsl_lpuart: " Ilpo Järvinen
                   ` (29 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/fsl_linflexuart.c b/drivers/tty/serial/fsl_linflexuart.c
index 84e8153e5420..6fc21b6684e6 100644
--- a/drivers/tty/serial/fsl_linflexuart.c
+++ b/drivers/tty/serial/fsl_linflexuart.c
@@ -178,8 +178,7 @@ static inline void linflex_transmit_buffer(struct uart_port *sport)
 
 	while (!uart_circ_empty(xmit)) {
 		linflex_put_char(sport, xmit->buf[xmit->tail]);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		sport->icount.tx++;
+		uart_xmit_advance(sport, 1);
 	}
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 16/44] serial: fsl_lpuart: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (14 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 15/44] serial: linflexuart: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 17/44] serial: imx: " Ilpo Järvinen
                   ` (28 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 67fa113f77d4..1c9c9f5e3610 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -535,9 +535,7 @@ static void lpuart_dma_tx_complete(void *arg)
 	dma_unmap_sg(chan->device->dev, sgl, sport->dma_tx_nents,
 		     DMA_TO_DEVICE);
 
-	xmit->tail = (xmit->tail + sport->dma_tx_bytes) & (UART_XMIT_SIZE - 1);
-
-	sport->port.icount.tx += sport->dma_tx_bytes;
+	uart_xmit_advance(&sport->port, sport->dma_tx_bytes);
 	sport->dma_tx_in_progress = false;
 	spin_unlock_irqrestore(&sport->port.lock, flags);
 
@@ -792,8 +790,7 @@ static inline void lpuart32_transmit_buffer(struct lpuart_port *sport)
 	txcnt &= UARTWATER_COUNT_MASK;
 	while (!uart_circ_empty(xmit) && (txcnt < sport->txfifo_size)) {
 		lpuart32_write(&sport->port, xmit->buf[xmit->tail], UARTDATA);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		sport->port.icount.tx++;
+		uart_xmit_advance(&sport->port, 1);
 		txcnt = lpuart32_read(&sport->port, UARTWATER);
 		txcnt = txcnt >> UARTWATER_TXCNT_OFF;
 		txcnt &= UARTWATER_COUNT_MASK;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 17/44] serial: imx: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (15 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 16/44] serial: fsl_lpuart: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19 13:14   ` Uwe Kleine-König
  2022-10-19  9:11 ` [PATCH 18/44] serial: ip22zilog: " Ilpo Järvinen
                   ` (27 subsequent siblings)
  44 siblings, 1 reply; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	linux-arm-kernel, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 05b432dc7a85..a7548d0a1aee 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -563,8 +563,7 @@ static inline void imx_uart_transmit_buffer(struct imx_port *sport)
 		/* send xmit->buf[xmit->tail]
 		 * out the port here */
 		imx_uart_writel(sport, xmit->buf[xmit->tail], URTX0);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		sport->port.icount.tx++;
+		uart_xmit_advance(&sport->port, 1);
 	}
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
@@ -590,9 +589,7 @@ static void imx_uart_dma_tx_callback(void *data)
 	ucr1 &= ~UCR1_TXDMAEN;
 	imx_uart_writel(sport, ucr1, UCR1);
 
-	/* update the stat */
-	xmit->tail = (xmit->tail + sport->tx_bytes) & (UART_XMIT_SIZE - 1);
-	sport->port.icount.tx += sport->tx_bytes;
+	uart_xmit_advance(&sport->port, sport->tx_bytes);
 
 	dev_dbg(sport->port.dev, "we finish the TX DMA.\n");
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 18/44] serial: ip22zilog: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (16 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 17/44] serial: imx: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 19/44] serial: liteuart: " Ilpo Järvinen
                   ` (26 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/ip22zilog.c b/drivers/tty/serial/ip22zilog.c
index dd0a8915ce4f..b1f27e168135 100644
--- a/drivers/tty/serial/ip22zilog.c
+++ b/drivers/tty/serial/ip22zilog.c
@@ -409,8 +409,7 @@ static void ip22zilog_transmit_chars(struct uart_ip22zilog_port *up,
 	ZSDELAY();
 	ZS_WSYNC(channel);
 
-	xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-	up->port.icount.tx++;
+	uart_xmit_advance(&up->port, 1);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(&up->port);
@@ -609,8 +608,7 @@ static void ip22zilog_start_tx(struct uart_port *port)
 		ZSDELAY();
 		ZS_WSYNC(channel);
 
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 
 		if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 			uart_write_wakeup(&up->port);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 19/44] serial: liteuart: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (17 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 18/44] serial: ip22zilog: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19 14:59   ` Gabriel L. Somlo
  2022-10-19  9:11 ` [PATCH 20/44] serial: max3100: " Ilpo Järvinen
                   ` (25 subsequent siblings)
  44 siblings, 1 reply; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Karol Gugala, Mateusz Holenko,
	Gabriel Somlo, Joel Stanley, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
index 4c0604325ee9..062812fe1b09 100644
--- a/drivers/tty/serial/liteuart.c
+++ b/drivers/tty/serial/liteuart.c
@@ -136,8 +136,7 @@ static void liteuart_start_tx(struct uart_port *port)
 	} else if (!uart_circ_empty(xmit)) {
 		while (xmit->head != xmit->tail) {
 			ch = xmit->buf[xmit->tail];
-			xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-			port->icount.tx++;
+			uart_xmit_advance(port, 1);
 			liteuart_putchar(port, ch);
 		}
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 20/44] serial: max3100: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (18 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 19/44] serial: liteuart: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 21/44] serial: max310x: " Ilpo Järvinen
                   ` (24 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
index c69602f356fd..bb74f23251fe 100644
--- a/drivers/tty/serial/max3100.c
+++ b/drivers/tty/serial/max3100.c
@@ -292,9 +292,7 @@ static void max3100_work(struct work_struct *w)
 			} else if (!uart_circ_empty(xmit) &&
 				   !uart_tx_stopped(&s->port)) {
 				tx = xmit->buf[xmit->tail];
-				xmit->tail = (xmit->tail + 1) &
-					(UART_XMIT_SIZE - 1);
-				s->port.icount.tx++;
+				uart_xmit_advance(&s->port, 1);
 			}
 			if (tx != 0xffff) {
 				max3100_calc_parity(s, &tx);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 21/44] serial: max310x: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (19 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 20/44] serial: max3100: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19 11:10   ` Andy Shevchenko
  2022-10-19  9:11 ` [PATCH 22/44] serial: meson: " Ilpo Järvinen
                   ` (23 subsequent siblings)
  44 siblings, 1 reply; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/tty/serial/max310x.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index fbf6e2b3161c..4eb24e3407f8 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -787,10 +787,7 @@ static void max310x_handle_tx(struct uart_port *port)
 		} else {
 			max310x_batch_write(port, xmit->buf + xmit->tail, to_send);
 		}
-
-		/* Add data to send */
-		port->icount.tx += to_send;
-		xmit->tail = (xmit->tail + to_send) & (UART_XMIT_SIZE - 1);
+		uart_xmit_advance(port, to_send);
 	}
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 22/44] serial: meson: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (20 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 21/44] serial: max310x: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:36   ` Neil Armstrong
  2022-10-19 20:42   ` Martin Blumenstingl
  2022-10-19  9:11 ` [PATCH 23/44] serial: milbeaut_usio: " Ilpo Järvinen
                   ` (22 subsequent siblings)
  44 siblings, 2 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, linux-arm-kernel,
	linux-amlogic, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index 056243c12836..74110017988a 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -162,8 +162,7 @@ static void meson_uart_start_tx(struct uart_port *port)
 
 		ch = xmit->buf[xmit->tail];
 		writel(ch, port->membase + AML_UART_WFIFO);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 	}
 
 	if (!uart_circ_empty(xmit)) {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 23/44] serial: milbeaut_usio: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (21 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 22/44] serial: meson: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 24/44] serial: mvebu-uart: " Ilpo Järvinen
                   ` (21 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Taichi Sugaya, Takao Orito,
	linux-arm-kernel, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/milbeaut_usio.c b/drivers/tty/serial/milbeaut_usio.c
index c15e0d84dc7e..44988a2941b8 100644
--- a/drivers/tty/serial/milbeaut_usio.c
+++ b/drivers/tty/serial/milbeaut_usio.c
@@ -98,8 +98,7 @@ static void mlb_usio_tx_chars(struct uart_port *port)
 	do {
 		writew(xmit->buf[xmit->tail], port->membase + MLB_USIO_REG_DR);
 
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 		if (uart_circ_empty(xmit))
 			break;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 24/44] serial: mvebu-uart: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (22 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 23/44] serial: milbeaut_usio: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-20 20:12   ` Pali Rohár
  2022-10-19  9:11 ` [PATCH 25/44] serial: pic32: " Ilpo Järvinen
                   ` (20 subsequent siblings)
  44 siblings, 1 reply; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Pali Rohár, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
index ba16e1da6bd3..ba9a6206daae 100644
--- a/drivers/tty/serial/mvebu-uart.c
+++ b/drivers/tty/serial/mvebu-uart.c
@@ -223,8 +223,7 @@ static void mvebu_uart_start_tx(struct uart_port *port)
 
 	if (IS_EXTENDED(port) && !uart_circ_empty(xmit)) {
 		writel(xmit->buf[xmit->tail], port->membase + UART_TSH(port));
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 	}
 
 	ctl = readl(port->membase + UART_INTR(port));
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 25/44] serial: pic32: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (23 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 24/44] serial: mvebu-uart: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 26/44] serial: pmac_zilog: " Ilpo Järvinen
                   ` (19 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c
index 2beada66c824..52d026865a32 100644
--- a/drivers/tty/serial/pic32_uart.c
+++ b/drivers/tty/serial/pic32_uart.c
@@ -376,8 +376,7 @@ static void pic32_uart_do_tx(struct uart_port *port)
 
 		pic32_uart_writel(sport, PIC32_UART_TX, c);
 
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 		if (uart_circ_empty(xmit))
 			break;
 		if (--max_count == 0)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 26/44] serial: pmac_zilog: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (24 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 25/44] serial: pic32: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 27/44] serial: rda: " Ilpo Järvinen
                   ` (18 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, linuxppc-dev, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index fe2e4ec423f7..13668ffdb1e7 100644
--- a/drivers/tty/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
@@ -410,8 +410,7 @@ static void pmz_transmit_chars(struct uart_pmac_port *uap)
 	write_zsdata(uap, xmit->buf[xmit->tail]);
 	zssync(uap);
 
-	xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-	uap->port.icount.tx++;
+	uart_xmit_advance(&uap->port, 1);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(&uap->port);
@@ -627,8 +626,7 @@ static void pmz_start_tx(struct uart_port *port)
 			return;
 		write_zsdata(uap, xmit->buf[xmit->tail]);
 		zssync(uap);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 
 		if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 			uart_write_wakeup(&uap->port);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 27/44] serial: rda: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (25 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 26/44] serial: pmac_zilog: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 28/44] serial: samsung_tty: " Ilpo Järvinen
                   ` (17 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Manivannan Sadhasivam,
	linux-arm-kernel, linux-unisoc, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/rda-uart.c b/drivers/tty/serial/rda-uart.c
index 0e387e2144fa..be5c842b5ba9 100644
--- a/drivers/tty/serial/rda-uart.c
+++ b/drivers/tty/serial/rda-uart.c
@@ -353,8 +353,7 @@ static void rda_uart_send_chars(struct uart_port *port)
 
 		ch = xmit->buf[xmit->tail];
 		rda_uart_write(port, ch, RDA_UART_RXTX_BUFFER);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 	}
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 28/44] serial: samsung_tty: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (26 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 27/44] serial: rda: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-21 11:48   ` Sam Protsenko
  2022-10-19  9:11 ` [PATCH 29/44] serial: sb1250-duart: " Ilpo Järvinen
                   ` (16 subsequent siblings)
  44 siblings, 1 reply; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Krzysztof Kozlowski,
	Alim Akhtar, linux-arm-kernel, linux-samsung-soc, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

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(-)

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


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 29/44] serial: sb1250-duart: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (27 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 28/44] serial: samsung_tty: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 30/44] serial: sccnxp: " Ilpo Järvinen
                   ` (15 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c
index c5d2b6cdcb4a..de56f383964e 100644
--- a/drivers/tty/serial/sb1250-duart.c
+++ b/drivers/tty/serial/sb1250-duart.c
@@ -399,8 +399,7 @@ static void sbd_transmit_chars(struct sbd_port *sport)
 	/* Send char.  */
 	if (!stop_tx) {
 		write_sbdchn(sport, R_DUART_TX_HOLD, xmit->buf[xmit->tail]);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		sport->port.icount.tx++;
+		uart_xmit_advance(&sport->port, 1);
 
 		if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 			uart_write_wakeup(&sport->port);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 30/44] serial: sccnxp: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (28 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 29/44] serial: sb1250-duart: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 31/44] serial: tegra: " Ilpo Järvinen
                   ` (14 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c
index dd98509f52e5..7df687822634 100644
--- a/drivers/tty/serial/sccnxp.c
+++ b/drivers/tty/serial/sccnxp.c
@@ -468,8 +468,7 @@ static void sccnxp_handle_tx(struct uart_port *port)
 			break;
 
 		sccnxp_port_write(port, SCCNXP_THR_REG, xmit->buf[xmit->tail]);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 	}
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 31/44] serial: tegra: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (29 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 30/44] serial: sccnxp: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19 17:05   ` Thierry Reding
  2022-10-19  9:11 ` [PATCH 32/44] serial: sh-sci: " Ilpo Järvinen
                   ` (13 subsequent siblings)
  44 siblings, 1 reply; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Laxman Dewangan,
	Thierry Reding, Jonathan Hunter, linux-tegra, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index b7170cb9a544..4304e3f9307d 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -496,8 +496,7 @@ static void tegra_uart_fill_tx_fifo(struct tegra_uart_port *tup, int max_bytes)
 				break;
 		}
 		tegra_uart_write(tup, xmit->buf[xmit->tail], UART_TX);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		tup->uport.icount.tx++;
+		uart_xmit_advance(&tup->uport, 1);
 	}
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 32/44] serial: sh-sci: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (30 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 31/44] serial: tegra: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 33/44] serial: sprd: " Ilpo Järvinen
                   ` (12 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/tty/serial/sh-sci.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 62f773286d44..a92a89780357 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1181,10 +1181,7 @@ static void sci_dma_tx_complete(void *arg)
 
 	spin_lock_irqsave(&port->lock, flags);
 
-	xmit->tail += s->tx_dma_len;
-	xmit->tail &= UART_XMIT_SIZE - 1;
-
-	port->icount.tx += s->tx_dma_len;
+	uart_xmit_advance(port, s->tx_dma_len);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(port);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 33/44] serial: sprd: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (31 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 32/44] serial: sh-sci: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19 10:49   ` Baolin Wang
  2022-10-19  9:11 ` [PATCH 34/44] serial: stm32: " Ilpo Järvinen
                   ` (11 subsequent siblings)
  44 siblings, 1 reply; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Orson Zhai, Baolin Wang,
	Chunyan Zhang, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
index 342a87967631..eae700809342 100644
--- a/drivers/tty/serial/sprd_serial.c
+++ b/drivers/tty/serial/sprd_serial.c
@@ -206,7 +206,6 @@ static void sprd_stop_tx_dma(struct uart_port *port)
 {
 	struct sprd_uart_port *sp =
 		container_of(port, struct sprd_uart_port, port);
-	struct circ_buf *xmit = &port->state->xmit;
 	struct dma_tx_state state;
 	u32 trans_len;
 
@@ -215,8 +214,7 @@ static void sprd_stop_tx_dma(struct uart_port *port)
 	dmaengine_tx_status(sp->tx_dma.chn, sp->tx_dma.cookie, &state);
 	if (state.residue) {
 		trans_len = state.residue - sp->tx_dma.phys_addr;
-		xmit->tail = (xmit->tail + trans_len) & (UART_XMIT_SIZE - 1);
-		port->icount.tx += trans_len;
+		uart_xmit_advance(port, trans_len);
 		dma_unmap_single(port->dev, sp->tx_dma.phys_addr,
 				 sp->tx_dma.trans_len, DMA_TO_DEVICE);
 	}
@@ -253,8 +251,7 @@ static void sprd_complete_tx_dma(void *data)
 	dma_unmap_single(port->dev, sp->tx_dma.phys_addr,
 			 sp->tx_dma.trans_len, DMA_TO_DEVICE);
 
-	xmit->tail = (xmit->tail + sp->tx_dma.trans_len) & (UART_XMIT_SIZE - 1);
-	port->icount.tx += sp->tx_dma.trans_len;
+	uart_xmit_advance(port, sp->tx_dma.trans_len);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(port);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 34/44] serial: stm32: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (32 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 33/44] serial: sprd: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 35/44] serial: sunhv: " Ilpo Järvinen
                   ` (10 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Maxime Coquelin,
	Alexandre Torgue, linux-stm32, linux-arm-kernel, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index dfdbcf092fac..24def72b2565 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -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:
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 35/44] serial: sunhv: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (33 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 34/44] serial: stm32: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 36/44] serial: sunplus-uart: " Ilpo Järvinen
                   ` (9 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, David S. Miller, sparclinux,
	linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c
index 1938ba5e98c0..16c746a63258 100644
--- a/drivers/tty/serial/sunhv.c
+++ b/drivers/tty/serial/sunhv.c
@@ -47,8 +47,7 @@ static void transmit_chars_putchar(struct uart_port *port, struct circ_buf *xmit
 		if (status != HV_EOK)
 			break;
 
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 	}
 }
 
@@ -63,8 +62,7 @@ static void transmit_chars_write(struct uart_port *port, struct circ_buf *xmit)
 		status = sun4v_con_write(ra, len, &sent);
 		if (status != HV_EOK)
 			break;
-		xmit->tail = (xmit->tail + sent) & (UART_XMIT_SIZE - 1);
-		port->icount.tx += sent;
+		uart_xmit_advance(port, sent);
 	}
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 36/44] serial: sunplus-uart: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (34 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 35/44] serial: sunhv: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 37/44] serial: sunsab: " Ilpo Järvinen
                   ` (8 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Hammer Hsieh, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/sunplus-uart.c b/drivers/tty/serial/sunplus-uart.c
index 7afe61a0e72e..727942c43c45 100644
--- a/drivers/tty/serial/sunplus-uart.c
+++ b/drivers/tty/serial/sunplus-uart.c
@@ -216,9 +216,7 @@ static void transmit_chars(struct uart_port *port)
 
 	do {
 		sp_uart_put_char(port, xmit->buf[xmit->tail]);
-		xmit->tail = (xmit->tail + 1) % UART_XMIT_SIZE;
-		port->icount.tx++;
-
+		uart_xmit_advance(port, 1);
 		if (uart_circ_empty(xmit))
 			break;
 	} while (sunplus_tx_buf_not_full(port));
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 37/44] serial: sunsab: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (35 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 36/44] serial: sunplus-uart: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 38/44] serial: sunsu: " Ilpo Järvinen
                   ` (7 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, David S. Miller, sparclinux,
	linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c
index 99608b2a2b74..94db67f21abf 100644
--- a/drivers/tty/serial/sunsab.c
+++ b/drivers/tty/serial/sunsab.c
@@ -266,8 +266,7 @@ static void transmit_chars(struct uart_sunsab_port *up,
 	for (i = 0; i < up->port.fifosize; i++) {
 		writeb(xmit->buf[xmit->tail],
 		       &up->regs->w.xfifo[i]);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		up->port.icount.tx++;
+		uart_xmit_advance(&up->port, 1);
 		if (uart_circ_empty(xmit))
 			break;
 	}
@@ -453,8 +452,7 @@ static void sunsab_start_tx(struct uart_port *port)
 	for (i = 0; i < up->port.fifosize; i++) {
 		writeb(xmit->buf[xmit->tail],
 		       &up->regs->w.xfifo[i]);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		up->port.icount.tx++;
+		uart_xmit_advance(&up->port, 1);
 		if (uart_circ_empty(xmit))
 			break;
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 38/44] serial: sunsu: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (36 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 37/44] serial: sunsab: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 39/44] serial: sunzilog: " Ilpo Järvinen
                   ` (6 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, David S. Miller, sparclinux,
	linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index 9ea7e567540d..fed052a0b931 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -417,8 +417,7 @@ static void transmit_chars(struct uart_sunsu_port *up)
 	count = up->port.fifosize;
 	do {
 		serial_out(up, UART_TX, xmit->buf[xmit->tail]);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		up->port.icount.tx++;
+		uart_xmit_advance(&up->port, 1);
 		if (uart_circ_empty(xmit))
 			break;
 	} while (--count > 0);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 39/44] serial: sunzilog: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (37 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 38/44] serial: sunsu: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 40/44] serial: timbuart: " Ilpo Järvinen
                   ` (5 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, David S. Miller, sparclinux,
	linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c
index 87425290687d..ccb809216e94 100644
--- a/drivers/tty/serial/sunzilog.c
+++ b/drivers/tty/serial/sunzilog.c
@@ -508,8 +508,7 @@ static void sunzilog_transmit_chars(struct uart_sunzilog_port *up,
 	ZSDELAY();
 	ZS_WSYNC(channel);
 
-	xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-	up->port.icount.tx++;
+	uart_xmit_advance(&up->port, 1);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(&up->port);
@@ -709,8 +708,7 @@ static void sunzilog_start_tx(struct uart_port *port)
 		ZSDELAY();
 		ZS_WSYNC(channel);
 
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 
 		if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 			uart_write_wakeup(&up->port);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 40/44] serial: timbuart: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (38 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 39/44] serial: sunzilog: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 41/44] serial: uartlite: " Ilpo Järvinen
                   ` (4 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/timbuart.c b/drivers/tty/serial/timbuart.c
index bb19ed012def..0859394a78cd 100644
--- a/drivers/tty/serial/timbuart.c
+++ b/drivers/tty/serial/timbuart.c
@@ -101,8 +101,7 @@ static void timbuart_tx_chars(struct uart_port *port)
 		!uart_circ_empty(xmit)) {
 		iowrite8(xmit->buf[xmit->tail],
 			port->membase + TIMBUART_TXFIFO);
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		port->icount.tx++;
+		uart_xmit_advance(port, 1);
 	}
 
 	dev_dbg(port->dev,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 41/44] serial: uartlite: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (39 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 40/44] serial: timbuart: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 42/44] serial: ucc_uart: " Ilpo Järvinen
                   ` (3 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Peter Korsgaard, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index eca41ac5477c..94584e54ebbe 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -203,8 +203,7 @@ static int ulite_transmit(struct uart_port *port, int stat)
 		return 0;
 
 	uart_out32(xmit->buf[xmit->tail], ULITE_TX, port);
-	xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE-1);
-	port->icount.tx++;
+	uart_xmit_advance(port, 1);
 
 	/* wake up */
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 42/44] serial: ucc_uart: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (40 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 41/44] serial: uartlite: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 43/44] serial: xuartps: " Ilpo Järvinen
                   ` (2 subsequent siblings)
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Timur Tabi, linuxppc-dev,
	linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 82cf14dd3d43..b09b6496ee3e 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -372,8 +372,7 @@ static int qe_uart_tx_pump(struct uart_qe_port *qe_port)
 		p = qe2cpu_addr(be32_to_cpu(bdp->buf), qe_port);
 		while (count < qe_port->tx_fifosize) {
 			*p++ = xmit->buf[xmit->tail];
-			xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-			port->icount.tx++;
+			uart_xmit_advance(port, 1);
 			count++;
 			if (xmit->head == xmit->tail)
 				break;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 43/44] serial: xuartps: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (41 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 42/44] serial: ucc_uart: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19  9:11 ` [PATCH 44/44] serial: zs: " Ilpo Järvinen
  2022-10-19 10:55 ` [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Jiri Slaby
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Michal Simek,
	linux-arm-kernel, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 2eff7cff57c4..01d8027e64fd 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -326,9 +326,7 @@ static void cdns_uart_handle_tx(void *dev_id)
 	       !(readl(port->membase + CDNS_UART_SR) & CDNS_UART_SR_TXFULL)) {
 
 		writel(xmit->buf[xmit->tail], port->membase + CDNS_UART_FIFO);
-
-		port->icount.tx++;
-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
+		uart_xmit_advance(port, 1);
 		numbytes--;
 	}
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 44/44] serial: zs: Use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (42 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 43/44] serial: xuartps: " Ilpo Järvinen
@ 2022-10-19  9:11 ` Ilpo Järvinen
  2022-10-19 10:55 ` [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Jiri Slaby
  44 siblings, 0 replies; 61+ messages in thread
From: Ilpo Järvinen @ 2022-10-19  9:11 UTC (permalink / raw)
  To: linux-serial, Greg KH, Jiri Slaby, Maciej W. Rozycki, linux-kernel
  Cc: Andy Shevchenko, Ilpo Järvinen

Take advantage of the new uart_xmit_advance() helper.

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

diff --git a/drivers/tty/serial/zs.c b/drivers/tty/serial/zs.c
index 688db7d8b748..730c648e32ff 100644
--- a/drivers/tty/serial/zs.c
+++ b/drivers/tty/serial/zs.c
@@ -623,8 +623,7 @@ static void zs_raw_transmit_chars(struct zs_port *zport)
 
 	/* Send char.  */
 	write_zsdata(zport, xmit->buf[xmit->tail]);
-	xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-	zport->port.icount.tx++;
+	uart_xmit_advance(&zport->port, 1);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(&zport->port);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 61+ messages in thread

* Re: [PATCH 22/44] serial: meson: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 22/44] serial: meson: " Ilpo Järvinen
@ 2022-10-19  9:36   ` Neil Armstrong
  2022-10-19 20:42   ` Martin Blumenstingl
  1 sibling, 0 replies; 61+ messages in thread
From: Neil Armstrong @ 2022-10-19  9:36 UTC (permalink / raw)
  To: Ilpo Järvinen, linux-serial, Greg KH, Jiri Slaby,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-arm-kernel, linux-amlogic, linux-kernel
  Cc: Andy Shevchenko

On 19/10/2022 11:11, Ilpo Järvinen wrote:
> Take advantage of the new uart_xmit_advance() helper.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>   drivers/tty/serial/meson_uart.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
> index 056243c12836..74110017988a 100644
> --- a/drivers/tty/serial/meson_uart.c
> +++ b/drivers/tty/serial/meson_uart.c
> @@ -162,8 +162,7 @@ static void meson_uart_start_tx(struct uart_port *port)
>   
>   		ch = xmit->buf[xmit->tail];
>   		writel(ch, port->membase + AML_UART_WFIFO);
> -		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
> -		port->icount.tx++;
> +		uart_xmit_advance(port, 1);
>   	}
>   
>   	if (!uart_circ_empty(xmit)) {


Acked-by: Neil Armstrong <neil.armstrong@linaro.org>

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 33/44] serial: sprd: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 33/44] serial: sprd: " Ilpo Järvinen
@ 2022-10-19 10:49   ` Baolin Wang
  0 siblings, 0 replies; 61+ messages in thread
From: Baolin Wang @ 2022-10-19 10:49 UTC (permalink / raw)
  To: Ilpo Järvinen, linux-serial, Greg KH, Jiri Slaby,
	Orson Zhai, Chunyan Zhang, linux-kernel
  Cc: Andy Shevchenko

Hi,

On 10/19/2022 5:11 PM, Ilpo Järvinen wrote:
> Take advantage of the new uart_xmit_advance() helper.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

LGTM. Thanks.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> ---
>   drivers/tty/serial/sprd_serial.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
> index 342a87967631..eae700809342 100644
> --- a/drivers/tty/serial/sprd_serial.c
> +++ b/drivers/tty/serial/sprd_serial.c
> @@ -206,7 +206,6 @@ static void sprd_stop_tx_dma(struct uart_port *port)
>   {
>   	struct sprd_uart_port *sp =
>   		container_of(port, struct sprd_uart_port, port);
> -	struct circ_buf *xmit = &port->state->xmit;
>   	struct dma_tx_state state;
>   	u32 trans_len;
>   
> @@ -215,8 +214,7 @@ static void sprd_stop_tx_dma(struct uart_port *port)
>   	dmaengine_tx_status(sp->tx_dma.chn, sp->tx_dma.cookie, &state);
>   	if (state.residue) {
>   		trans_len = state.residue - sp->tx_dma.phys_addr;
> -		xmit->tail = (xmit->tail + trans_len) & (UART_XMIT_SIZE - 1);
> -		port->icount.tx += trans_len;
> +		uart_xmit_advance(port, trans_len);
>   		dma_unmap_single(port->dev, sp->tx_dma.phys_addr,
>   				 sp->tx_dma.trans_len, DMA_TO_DEVICE);
>   	}
> @@ -253,8 +251,7 @@ static void sprd_complete_tx_dma(void *data)
>   	dma_unmap_single(port->dev, sp->tx_dma.phys_addr,
>   			 sp->tx_dma.trans_len, DMA_TO_DEVICE);
>   
> -	xmit->tail = (xmit->tail + sp->tx_dma.trans_len) & (UART_XMIT_SIZE - 1);
> -	port->icount.tx += sp->tx_dma.trans_len;
> +	uart_xmit_advance(port, sp->tx_dma.trans_len);
>   
>   	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
>   		uart_write_wakeup(port);

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance()
  2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
                   ` (43 preceding siblings ...)
  2022-10-19  9:11 ` [PATCH 44/44] serial: zs: " Ilpo Järvinen
@ 2022-10-19 10:55 ` Jiri Slaby
  44 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2022-10-19 10:55 UTC (permalink / raw)
  To: Ilpo Järvinen, linux-serial, Greg KH; +Cc: linux-kernel, Andy Shevchenko

On 19. 10. 22, 11:11, Ilpo Järvinen wrote:
> I've tried to pick the drivers such that these shouldn't collide with
> the ones Jiri's tx loop rewrite series is touching (unless he has
> something hidden beyond what has been on the list).

No, nothing more here.

thanks,
-- 
js


^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 21/44] serial: max310x: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 21/44] serial: max310x: " Ilpo Järvinen
@ 2022-10-19 11:10   ` Andy Shevchenko
  0 siblings, 0 replies; 61+ messages in thread
From: Andy Shevchenko @ 2022-10-19 11:10 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: linux-serial, Greg KH, Jiri Slaby, linux-kernel

On Wed, Oct 19, 2022 at 12:11:28PM +0300, Ilpo Järvinen wrote:
> Take advantage of the new uart_xmit_advance() helper.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>  drivers/tty/serial/max310x.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
> index fbf6e2b3161c..4eb24e3407f8 100644
> --- a/drivers/tty/serial/max310x.c
> +++ b/drivers/tty/serial/max310x.c
> @@ -787,10 +787,7 @@ static void max310x_handle_tx(struct uart_port *port)
>  		} else {
>  			max310x_batch_write(port, xmit->buf + xmit->tail, to_send);
>  		}
> -
> -		/* Add data to send */
> -		port->icount.tx += to_send;
> -		xmit->tail = (xmit->tail + to_send) & (UART_XMIT_SIZE - 1);
> +		uart_xmit_advance(port, to_send);
>  	}
>  
>  	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
> -- 
> 2.30.2
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 04/44] serial: pch_uart: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 04/44] serial: pch_uart: " Ilpo Järvinen
@ 2022-10-19 11:11   ` Andy Shevchenko
  0 siblings, 0 replies; 61+ messages in thread
From: Andy Shevchenko @ 2022-10-19 11:11 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: linux-serial, Greg KH, Jiri Slaby, linux-kernel

On Wed, Oct 19, 2022 at 12:11:11PM +0300, Ilpo Järvinen wrote:
> Take advantage of the new uart_xmit_advance() helper.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>  drivers/tty/serial/pch_uart.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
> index c59ce7886579..c76719c0f453 100644
> --- a/drivers/tty/serial/pch_uart.c
> +++ b/drivers/tty/serial/pch_uart.c
> @@ -738,15 +738,12 @@ static void pch_dma_tx_complete(void *arg)
>  {
>  	struct eg20t_port *priv = arg;
>  	struct uart_port *port = &priv->port;
> -	struct circ_buf *xmit = &port->state->xmit;
>  	struct scatterlist *sg = priv->sg_tx_p;
>  	int i;
>  
> -	for (i = 0; i < priv->nent; i++, sg++) {
> -		xmit->tail += sg_dma_len(sg);
> -		port->icount.tx += sg_dma_len(sg);
> -	}
> -	xmit->tail &= UART_XMIT_SIZE - 1;
> +	for (i = 0; i < priv->nent; i++, sg++)
> +		uart_xmit_advance(port, sg_dma_len(sg));
> +
>  	async_tx_ack(priv->desc_tx);
>  	dma_unmap_sg(port->dev, sg, priv->orig_nent, DMA_TO_DEVICE);
>  	priv->tx_dma_use = 0;
> @@ -843,8 +840,7 @@ static unsigned int handle_tx(struct eg20t_port *priv)
>  
>  	while (!uart_tx_stopped(port) && !uart_circ_empty(xmit) && fifo_size) {
>  		iowrite8(xmit->buf[xmit->tail], priv->membase + PCH_UART_THR);
> -		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
> -		port->icount.tx++;
> +		uart_xmit_advance(port, 1);
>  		fifo_size--;
>  		tx_empty = 0;
>  	}
> -- 
> 2.30.2
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 05/44] serial: sc16is7xx: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 05/44] serial: sc16is7xx: " Ilpo Järvinen
@ 2022-10-19 11:11   ` Andy Shevchenko
  0 siblings, 0 replies; 61+ messages in thread
From: Andy Shevchenko @ 2022-10-19 11:11 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: linux-serial, Greg KH, Jiri Slaby, linux-kernel

On Wed, Oct 19, 2022 at 12:11:12PM +0300, Ilpo Järvinen wrote:
> Take advantage of the new uart_xmit_advance() helper.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>  drivers/tty/serial/sc16is7xx.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
> index 524921360ca7..39f92eb1e698 100644
> --- a/drivers/tty/serial/sc16is7xx.c
> +++ b/drivers/tty/serial/sc16is7xx.c
> @@ -686,13 +686,10 @@ static void sc16is7xx_handle_tx(struct uart_port *port)
>  		}
>  		to_send = (to_send > txlen) ? txlen : to_send;
>  
> -		/* Add data to send */
> -		port->icount.tx += to_send;
> -
>  		/* Convert to linear buffer */
>  		for (i = 0; i < to_send; ++i) {
>  			s->buf[i] = xmit->buf[xmit->tail];
> -			xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
> +			uart_xmit_advance(port, 1);
>  		}
>  
>  		sc16is7xx_fifo_write(port, to_send);
> -- 
> 2.30.2
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 07/44] serial: 8250: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 07/44] serial: 8250: " Ilpo Järvinen
@ 2022-10-19 11:12   ` Andy Shevchenko
  0 siblings, 0 replies; 61+ messages in thread
From: Andy Shevchenko @ 2022-10-19 11:12 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: linux-serial, Greg KH, Jiri Slaby, linux-kernel

On Wed, Oct 19, 2022 at 12:11:14PM +0300, Ilpo Järvinen wrote:
> Take advantage of the new uart_xmit_advance() helper.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>  drivers/tty/serial/8250/8250_port.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index fe8662cd9402..b94e60e75326 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -1842,8 +1842,7 @@ void serial8250_tx_chars(struct uart_8250_port *up)
>  			 */
>  			serial_in(up, UART_SCR);
>  		}
> -		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
> -		port->icount.tx++;
> +		uart_xmit_advance(port, 1);
>  		if (uart_circ_empty(xmit))
>  			break;
>  		if ((up->capabilities & UART_CAP_HFIFO) &&
> -- 
> 2.30.2
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 14/44] serial: digicolor: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 14/44] serial: digicolor: " Ilpo Järvinen
@ 2022-10-19 11:30   ` Baruch Siach
  0 siblings, 0 replies; 61+ messages in thread
From: Baruch Siach @ 2022-10-19 11:30 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: linux-serial, Greg KH, Jiri Slaby, linux-arm-kernel,
	linux-kernel, Andy Shevchenko

Hi Ilpo,

On Wed, Oct 19 2022, Ilpo Järvinen wrote:
> Take advantage of the new uart_xmit_advance() helper.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Acked-by: Baruch Siach <baruch@tkos.co.il>

Thanks,
baruch

> ---
>  drivers/tty/serial/digicolor-usart.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/digicolor-usart.c b/drivers/tty/serial/digicolor-usart.c
> index 0c0a62346f23..ed197705f7ee 100644
> --- a/drivers/tty/serial/digicolor-usart.c
> +++ b/drivers/tty/serial/digicolor-usart.c
> @@ -202,8 +202,7 @@ static void digicolor_uart_tx(struct uart_port *port)
>  
>  	while (!uart_circ_empty(xmit)) {
>  		writeb(xmit->buf[xmit->tail], port->membase + UA_EMI_REC);
> -		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
> -		port->icount.tx++;
> +		uart_xmit_advance(port, 1);
>  
>  		if (digicolor_uart_tx_full(port))
>  			break;

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 17/44] serial: imx: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 17/44] serial: imx: " Ilpo Järvinen
@ 2022-10-19 13:14   ` Uwe Kleine-König
  0 siblings, 0 replies; 61+ messages in thread
From: Uwe Kleine-König @ 2022-10-19 13:14 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: linux-serial, Greg KH, Jiri Slaby, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	linux-arm-kernel, linux-kernel, Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]

On Wed, Oct 19, 2022 at 12:11:24PM +0300, Ilpo Järvinen wrote:
> Take advantage of the new uart_xmit_advance() helper.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards and thanks for adapting the imx driver
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 19/44] serial: liteuart: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 19/44] serial: liteuart: " Ilpo Järvinen
@ 2022-10-19 14:59   ` Gabriel L. Somlo
  0 siblings, 0 replies; 61+ messages in thread
From: Gabriel L. Somlo @ 2022-10-19 14:59 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: linux-serial, Greg KH, Jiri Slaby, Karol Gugala, Mateusz Holenko,
	Joel Stanley, linux-kernel, Andy Shevchenko

On Wed, Oct 19, 2022 at 12:11:26PM +0300, Ilpo Järvinen wrote:
> Take advantage of the new uart_xmit_advance() helper.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>  drivers/tty/serial/liteuart.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
> index 4c0604325ee9..062812fe1b09 100644
> --- a/drivers/tty/serial/liteuart.c
> +++ b/drivers/tty/serial/liteuart.c
> @@ -136,8 +136,7 @@ static void liteuart_start_tx(struct uart_port *port)
>  	} else if (!uart_circ_empty(xmit)) {
>  		while (xmit->head != xmit->tail) {
>  			ch = xmit->buf[xmit->tail];
> -			xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
> -			port->icount.tx++;
> +			uart_xmit_advance(port, 1);

Acked-by: Gabriel Somlo <gsomlo@gmail.com>

Thanks,
--Gabriel

>  			liteuart_putchar(port, ch);
>  		}
>  	}
> -- 
> 2.30.2
> 

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 31/44] serial: tegra: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 31/44] serial: tegra: " Ilpo Järvinen
@ 2022-10-19 17:05   ` Thierry Reding
  0 siblings, 0 replies; 61+ messages in thread
From: Thierry Reding @ 2022-10-19 17:05 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: linux-serial, Greg KH, Jiri Slaby, Laxman Dewangan,
	Jonathan Hunter, linux-tegra, linux-kernel, Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]

On Wed, Oct 19, 2022 at 12:11:38PM +0300, Ilpo Järvinen wrote:
> Take advantage of the new uart_xmit_advance() helper.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>  drivers/tty/serial/serial-tegra.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Looks good:

Reviewed-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 22/44] serial: meson: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 22/44] serial: meson: " Ilpo Järvinen
  2022-10-19  9:36   ` Neil Armstrong
@ 2022-10-19 20:42   ` Martin Blumenstingl
  1 sibling, 0 replies; 61+ messages in thread
From: Martin Blumenstingl @ 2022-10-19 20:42 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: linux-serial, Greg KH, Jiri Slaby, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, linux-arm-kernel, linux-amlogic, linux-kernel,
	Andy Shevchenko

On Wed, Oct 19, 2022 at 11:13 AM 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>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

That helper is a welcome improvement in my opinion. Thanks for working on this!

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 11/44] serial: atmel: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 11/44] serial: atmel: " Ilpo Järvinen
@ 2022-10-20  9:01   ` Claudiu.Beznea
  2022-10-20 13:06     ` Richard Genoud
  0 siblings, 1 reply; 61+ messages in thread
From: Claudiu.Beznea @ 2022-10-20  9:01 UTC (permalink / raw)
  To: ilpo.jarvinen, linux-serial, gregkh, jirislaby, richard.genoud,
	Nicolas.Ferre, alexandre.belloni, linux-arm-kernel, linux-kernel
  Cc: andriy.shevchenko

On 19.10.2022 12:11, Ilpo Järvinen wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Take advantage of the new uart_xmit_advance() helper.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>


> ---
>  drivers/tty/serial/atmel_serial.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index bd07f79a2df9..4485f2d26b77 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -875,10 +875,7 @@ static void atmel_complete_tx_dma(void *arg)
> 
>         if (chan)
>                 dmaengine_terminate_all(chan);
> -       xmit->tail += atmel_port->tx_len;
> -       xmit->tail &= UART_XMIT_SIZE - 1;
> -
> -       port->icount.tx += atmel_port->tx_len;
> +       uart_xmit_advance(port, atmel_port->tx_len);
> 
>         spin_lock_irq(&atmel_port->lock_tx);
>         async_tx_ack(atmel_port->desc_tx);
> @@ -1471,11 +1468,7 @@ static void atmel_tx_pdc(struct uart_port *port)
>         /* nothing left to transmit? */
>         if (atmel_uart_readl(port, ATMEL_PDC_TCR))
>                 return;
> -
> -       xmit->tail += pdc->ofs;
> -       xmit->tail &= UART_XMIT_SIZE - 1;
> -
> -       port->icount.tx += pdc->ofs;
> +       uart_xmit_advance(port, pdc->ofs);
>         pdc->ofs = 0;
> 
>         /* more to transmit - setup next transfer */
> --
> 2.30.2
> 


^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 11/44] serial: atmel: Use uart_xmit_advance()
  2022-10-20  9:01   ` Claudiu.Beznea
@ 2022-10-20 13:06     ` Richard Genoud
  0 siblings, 0 replies; 61+ messages in thread
From: Richard Genoud @ 2022-10-20 13:06 UTC (permalink / raw)
  To: Claudiu.Beznea, ilpo.jarvinen, linux-serial, gregkh, jirislaby,
	Nicolas.Ferre, alexandre.belloni, linux-arm-kernel, linux-kernel
  Cc: andriy.shevchenko

Le 20/10/2022 à 11:01, Claudiu.Beznea@microchip.com a écrit :
> On 19.10.2022 12:11, Ilpo Järvinen wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> Take advantage of the new uart_xmit_advance() helper.
>>
>> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> 
> Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Acked-By: Richard GENOUD <richard.genoud@gmail.com>

>> ---
>>  drivers/tty/serial/atmel_serial.c | 11 ++---------
>>  1 file changed, 2 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
>> index bd07f79a2df9..4485f2d26b77 100644
>> --- a/drivers/tty/serial/atmel_serial.c
>> +++ b/drivers/tty/serial/atmel_serial.c
>> @@ -875,10 +875,7 @@ static void atmel_complete_tx_dma(void *arg)
>>
>>         if (chan)
>>                 dmaengine_terminate_all(chan);
>> -       xmit->tail += atmel_port->tx_len;
>> -       xmit->tail &= UART_XMIT_SIZE - 1;
>> -
>> -       port->icount.tx += atmel_port->tx_len;
>> +       uart_xmit_advance(port, atmel_port->tx_len);
>>
>>         spin_lock_irq(&atmel_port->lock_tx);
>>         async_tx_ack(atmel_port->desc_tx);
>> @@ -1471,11 +1468,7 @@ static void atmel_tx_pdc(struct uart_port *port)
>>         /* nothing left to transmit? */
>>         if (atmel_uart_readl(port, ATMEL_PDC_TCR))
>>                 return;
>> -
>> -       xmit->tail += pdc->ofs;
>> -       xmit->tail &= UART_XMIT_SIZE - 1;
>> -
>> -       port->icount.tx += pdc->ofs;
>> +       uart_xmit_advance(port, pdc->ofs);
>>         pdc->ofs = 0;
>>
>>         /* more to transmit - setup next transfer */
>> --
>> 2.30.2
>>
> 

Thanks !

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 24/44] serial: mvebu-uart: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 24/44] serial: mvebu-uart: " Ilpo Järvinen
@ 2022-10-20 20:12   ` Pali Rohár
  0 siblings, 0 replies; 61+ messages in thread
From: Pali Rohár @ 2022-10-20 20:12 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: linux-serial, Greg KH, Jiri Slaby, linux-kernel, Andy Shevchenko

On Wednesday 19 October 2022 12:11:31 Ilpo Järvinen wrote:
> Take advantage of the new uart_xmit_advance() helper.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Reviewed-by: Pali Rohár <pali@kernel.org>

> ---
>  drivers/tty/serial/mvebu-uart.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
> index ba16e1da6bd3..ba9a6206daae 100644
> --- a/drivers/tty/serial/mvebu-uart.c
> +++ b/drivers/tty/serial/mvebu-uart.c
> @@ -223,8 +223,7 @@ static void mvebu_uart_start_tx(struct uart_port *port)
>  
>  	if (IS_EXTENDED(port) && !uart_circ_empty(xmit)) {
>  		writel(xmit->buf[xmit->tail], port->membase + UART_TSH(port));
> -		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
> -		port->icount.tx++;
> +		uart_xmit_advance(port, 1);
>  	}
>  
>  	ctl = readl(port->membase + UART_INTR(port));
> -- 
> 2.30.2
> 

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 28/44] serial: samsung_tty: Use uart_xmit_advance()
  2022-10-19  9:11 ` [PATCH 28/44] serial: samsung_tty: " Ilpo Järvinen
@ 2022-10-21 11:48   ` Sam Protsenko
  0 siblings, 0 replies; 61+ messages in thread
From: Sam Protsenko @ 2022-10-21 11:48 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: linux-serial, Greg KH, Jiri Slaby, Krzysztof Kozlowski,
	Alim Akhtar, linux-arm-kernel, linux-samsung-soc, linux-kernel,
	Andy Shevchenko

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
>

^ permalink raw reply	[flat|nested] 61+ messages in thread

end of thread, other threads:[~2022-10-21 11:48 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-19  9:11 [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 01/44] serial: dz: Use uart_xmit_advance() Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 02/44] serial: men_z135_uart: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 03/44] serial: msm: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 04/44] serial: pch_uart: " Ilpo Järvinen
2022-10-19 11:11   ` Andy Shevchenko
2022-10-19  9:11 ` [PATCH 05/44] serial: sc16is7xx: " Ilpo Järvinen
2022-10-19 11:11   ` Andy Shevchenko
2022-10-19  9:11 ` [PATCH 06/44] serial: 8250_bcm7271: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 07/44] serial: 8250: " Ilpo Järvinen
2022-10-19 11:12   ` Andy Shevchenko
2022-10-19  9:11 ` [PATCH 08/44] serial: pl011: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 09/44] serial: ar933x: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 10/44] serial: arc: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 11/44] serial: atmel: " Ilpo Järvinen
2022-10-20  9:01   ` Claudiu.Beznea
2022-10-20 13:06     ` Richard Genoud
2022-10-19  9:11 ` [PATCH 12/44] serial: clps711x: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 13/44] serial: cpm_uart: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 14/44] serial: digicolor: " Ilpo Järvinen
2022-10-19 11:30   ` Baruch Siach
2022-10-19  9:11 ` [PATCH 15/44] serial: linflexuart: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 16/44] serial: fsl_lpuart: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 17/44] serial: imx: " Ilpo Järvinen
2022-10-19 13:14   ` Uwe Kleine-König
2022-10-19  9:11 ` [PATCH 18/44] serial: ip22zilog: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 19/44] serial: liteuart: " Ilpo Järvinen
2022-10-19 14:59   ` Gabriel L. Somlo
2022-10-19  9:11 ` [PATCH 20/44] serial: max3100: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 21/44] serial: max310x: " Ilpo Järvinen
2022-10-19 11:10   ` Andy Shevchenko
2022-10-19  9:11 ` [PATCH 22/44] serial: meson: " Ilpo Järvinen
2022-10-19  9:36   ` Neil Armstrong
2022-10-19 20:42   ` Martin Blumenstingl
2022-10-19  9:11 ` [PATCH 23/44] serial: milbeaut_usio: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 24/44] serial: mvebu-uart: " Ilpo Järvinen
2022-10-20 20:12   ` Pali Rohár
2022-10-19  9:11 ` [PATCH 25/44] serial: pic32: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 26/44] serial: pmac_zilog: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 27/44] serial: rda: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 28/44] serial: samsung_tty: " Ilpo Järvinen
2022-10-21 11:48   ` Sam Protsenko
2022-10-19  9:11 ` [PATCH 29/44] serial: sb1250-duart: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 30/44] serial: sccnxp: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 31/44] serial: tegra: " Ilpo Järvinen
2022-10-19 17:05   ` Thierry Reding
2022-10-19  9:11 ` [PATCH 32/44] serial: sh-sci: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 33/44] serial: sprd: " Ilpo Järvinen
2022-10-19 10:49   ` Baolin Wang
2022-10-19  9:11 ` [PATCH 34/44] serial: stm32: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 35/44] serial: sunhv: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 36/44] serial: sunplus-uart: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 37/44] serial: sunsab: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 38/44] serial: sunsu: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 39/44] serial: sunzilog: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 40/44] serial: timbuart: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 41/44] serial: uartlite: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 42/44] serial: ucc_uart: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 43/44] serial: xuartps: " Ilpo Järvinen
2022-10-19  9:11 ` [PATCH 44/44] serial: zs: " Ilpo Järvinen
2022-10-19 10:55 ` [PATCH 00/44] serial: Convert drivers to use uart_xmit_advance() Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).