Skip to content

Commit

Permalink
serial: imx: TX DMA: clean up sg initialization
Browse files Browse the repository at this point in the history
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 <dirk.behme@de.bosch.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
dirkbehme authored and gregkh committed Jan 9, 2015
1 parent 55c3cb1 commit 7942f85
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/tty/serial/imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,15 +539,15 @@ static void imx_dma_tx(struct imx_port *sport)

sport->tx_bytes = uart_circ_chars_pending(xmit);

if (xmit->tail > xmit->head && xmit->head > 0) {
if (xmit->tail < xmit->head) {
sport->dma_tx_nents = 1;
sg_init_one(sgl, xmit->buf + xmit->tail, sport->tx_bytes);
} else {
sport->dma_tx_nents = 2;
sg_init_table(sgl, 2);
sg_set_buf(sgl, xmit->buf + xmit->tail,
UART_XMIT_SIZE - xmit->tail);
sg_set_buf(sgl + 1, xmit->buf, xmit->head);
} else {
sport->dma_tx_nents = 1;
sg_init_one(sgl, xmit->buf + xmit->tail, sport->tx_bytes);
}

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

0 comments on commit 7942f85

Please sign in to comment.