aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Brice <aaron.brice@datasoft.com>2016-10-06 18:13:04 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-27 10:41:56 -0400
commitd704b2d32c39c256dea659e142a31b875a13c63b (patch)
treee104411d0b6a56d00ed2f6a8b274ce95292e5d66
parentf00a7c57569db04633818bc5e0c0e35d62733b02 (diff)
tty: serial: fsl_lpuart: Fix Tx DMA edge case
In the case where head == 0 on the circular buffer, there should be one DMA buffer, not two. The second zero-length buffer would break the lpuart driver, transfer would never complete. Signed-off-by: Aaron Brice <aaron.brice@datasoft.com> Acked-by: Stefan Agner <stefan@agner.ch> Tested-by: Stefan Agner <stefan@agner.ch> Tested-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/fsl_lpuart.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index de9d5107c00a..76103f2c4a80 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -328,7 +328,7 @@ static void lpuart_dma_tx(struct lpuart_port *sport)
328 328
329 sport->dma_tx_bytes = uart_circ_chars_pending(xmit); 329 sport->dma_tx_bytes = uart_circ_chars_pending(xmit);
330 330
331 if (xmit->tail < xmit->head) { 331 if (xmit->tail < xmit->head || xmit->head == 0) {
332 sport->dma_tx_nents = 1; 332 sport->dma_tx_nents = 1;
333 sg_init_one(sgl, xmit->buf + xmit->tail, sport->dma_tx_bytes); 333 sg_init_one(sgl, xmit->buf + xmit->tail, sport->dma_tx_bytes);
334 } else { 334 } else {
@@ -359,7 +359,6 @@ static void lpuart_dma_tx(struct lpuart_port *sport)
359 sport->dma_tx_in_progress = true; 359 sport->dma_tx_in_progress = true;
360 sport->dma_tx_cookie = dmaengine_submit(sport->dma_tx_desc); 360 sport->dma_tx_cookie = dmaengine_submit(sport->dma_tx_desc);
361 dma_async_issue_pending(sport->dma_tx_chan); 361 dma_async_issue_pending(sport->dma_tx_chan);
362
363} 362}
364 363
365static void lpuart_dma_tx_complete(void *arg) 364static void lpuart_dma_tx_complete(void *arg)