[11/44] serial: atmel: Use uart_xmit_advance()

Message ID 20221019091151.6692-12-ilpo.jarvinen@linux.intel.com
State New
Headers
Series serial: Convert drivers to use uart_xmit_advance() |

Commit Message

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

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

Comments

Claudiu Beznea Oct. 20, 2022, 9:01 a.m. UTC | #1
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
>
  
Richard Genoud Oct. 20, 2022, 1:06 p.m. UTC | #2
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 !
  

Patch

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 */