serial: 8250_dma: couple of cleanups
v2 cover serial: 8250_dma: couple of cleanups
Here are couple of cleanups against DMA support for 8250 serial driver.
Since v1:
- rebase on top of tty-testing
- append patch 2/2
Andy Shevchenko (2):
serial: 8250_dma: call serial8250_tx_dma unconditionally
serial: 8250_dma: no need to set tx_err twice
drivers/tty/serial/8250/8250_dma.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
Signature · 1 line
2.1.1
PATCH v2 1/2 serial: 8250_dma: call serial8250_tx_dma unconditionally
Since we have the same check inside the function we may drop it away in __dma_tx_complete().
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/tty/serial/8250/8250_dma.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/tty/serial/8250/8250_dma.c +6 -9
@@ -21,6 +21,7 @@ static void __dma_tx_complete(void *param)struct uart_8250_dma *dma = p->dma;struct circ_buf *xmit = &p->port.state->xmit;unsigned long flags; +int ret;dma_sync_single_for_cpu (dma->txchan->device->dev, dma->tx_addr,UART_XMIT_SIZE ,DMA_TO_DEVICE );
@@ -36,15 +37,11 @@ static void __dma_tx_complete(void *param)if (uart_circ_chars_pending (xmit) <WAKEUP_CHARS )uart_write_wakeup (&p->port); -if (!uart_circ_empty (xmit) && !uart_tx_stopped (&p->port)) { -int ret; - - ret =serial8250_tx_dma (p); -if (ret) { - dma->tx_err =1 ; - p->ier |=UART_IER_THRI ; -serial_port_out (&p->port,UART_IER , p->ier); - } + ret =serial8250_tx_dma (p); +if (ret) { + dma->tx_err =1 ; + p->ier |=UART_IER_THRI ; +serial_port_out (&p->port,UART_IER , p->ier); }spin_unlock_irqrestore (&p->port.lock, flags);
Signature · 1 line
2.1.1
PATCH v2 2/2 serial: 8250_dma: no need to set tx_err twice
In reply to Andy ShevchenkoIn the serial8250_tx_dma() the tx_err flag is set in case of error. Thus, there is no need to repeat this in __dma_tx_complete().
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/tty/serial/8250/8250_dma.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/8250/8250_dma.c +0 -2
@@ -39,7 +39,6 @@ static void __dma_tx_complete(void *param) ret =serial8250_tx_dma (p);if (ret) { - dma->tx_err =1 ; p->ier |=UART_IER_THRI ;serial_port_out (&p->port,UART_IER , p->ier); }
@@ -93,7 +92,6 @@ int serial8250_tx_dma(struct uart_8250_port *p) } dma->tx_running =1 ; - desc->callback = __dma_tx_complete; desc->callback_param = p;
Signature · 1 line
2.1.1