Skip to content

Commit 7942f85

Browse files
dirkbehmegregkh
authored andcommitted
serial: imx: TX DMA: clean up sg initialization
Inverting the logic of the if statement for the sg initialization makes the if statement easier and better to read. No functional change. Signed-off-by: Dirk Behme <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 55c3cb1 commit 7942f85

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/tty/serial/imx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,15 +539,15 @@ static void imx_dma_tx(struct imx_port *sport)
539539

540540
sport->tx_bytes = uart_circ_chars_pending(xmit);
541541

542-
if (xmit->tail > xmit->head && xmit->head > 0) {
542+
if (xmit->tail < xmit->head) {
543+
sport->dma_tx_nents = 1;
544+
sg_init_one(sgl, xmit->buf + xmit->tail, sport->tx_bytes);
545+
} else {
543546
sport->dma_tx_nents = 2;
544547
sg_init_table(sgl, 2);
545548
sg_set_buf(sgl, xmit->buf + xmit->tail,
546549
UART_XMIT_SIZE - xmit->tail);
547550
sg_set_buf(sgl + 1, xmit->buf, xmit->head);
548-
} else {
549-
sport->dma_tx_nents = 1;
550-
sg_init_one(sgl, xmit->buf + xmit->tail, sport->tx_bytes);
551551
}
552552

553553
ret = dma_map_sg(dev, sgl, sport->dma_tx_nents, DMA_TO_DEVICE);

0 commit comments

Comments
 (0)