From: Dirk Behme Date: Tue, 9 Dec 2014 09:11:25 +0000 (+0900) Subject: serial: imx: TX DMA: clean up sg initialization X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7942f8577f2a63b7a6b8cd70f5354a608b30fead;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 146663c100fd..5cea7d257426 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -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);