Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1681522

[PATCH v2 1/6] serial: imx: only set DMA rx-ing when DMA starts

From Romain Perier <romain.perier@collabora.com>
Newsgroups linux.kernel
Subject [PATCH v2 1/6] serial: imx: only set DMA rx-ing when DMA starts
Date 2017-07-05 15:10 +0200
Message-ID <tZSe5-6Cw-7@gated-at.bofh.it> (permalink)
References <tZSe5-6Cw-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Nandor Han <nandor.han@ge.com>

Avoid the situation when `dma_is_rxing` could incorrectly signal that
DMA RX channel is receiving data in case DMA preparation or sg mapping
fails.

This commit fixes the issues by moving the assignment of dma_is_rxing
out of imx_disable_rx_int(), then the variable is set to 1 from
start_rx_dma() only when the preparation is correctly done.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Romain Perier <romain.perier@collabora.com>
---
 drivers/tty/serial/imx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 3bae4ea..01df430 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -729,8 +729,6 @@ static void imx_disable_rx_int(struct imx_port *sport)
 {
 	unsigned long temp;
 
-	sport->dma_is_rxing = 1;
-
 	/* disable the receiver ready and aging timer interrupts */
 	temp = readl(sport->port.membase + UCR1);
 	temp &= ~(UCR1_RRDYEN);
@@ -1083,6 +1081,7 @@ static int start_rx_dma(struct imx_port *sport)
 	desc->callback_param = sport;
 
 	dev_dbg(dev, "RX: prepare for the DMA.\n");
+	sport->dma_is_rxing = 1;
 	sport->rx_cookie = dmaengine_submit(desc);
 	dma_async_issue_pending(chan);
 	return 0;
-- 
1.8.3.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/6] serial: imx: only set DMA rx-ing when DMA starts Romain Perier <romain.perier@collabora.com> - 2017-07-05 15:10 +0200
  Re: [PATCH v2 1/6] serial: imx: only set DMA rx-ing when DMA starts Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-07-05 15:30 +0200
    Re: [PATCH v2 1/6] serial: imx: only set DMA rx-ing when DMA starts Romain Perier <romain.perier@collabora.com> - 2017-07-06 10:40 +0200
      Re: [PATCH v2 1/6] serial: imx: only set DMA rx-ing when DMA starts Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-07-06 12:10 +0200

csiph-web