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


Groups > linux.kernel > #1736821 > unrolled thread

[PATCH v3 2/6] serial: imx: only set dma_is_rxing when DMA starts

Started byMartyn Welch <martyn.welch@collabora.co.uk>
First post2017-09-21 18:20 +0200
Last post2017-09-21 20:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 2/6] serial: imx: only set dma_is_rxing when DMA starts Martyn Welch <martyn.welch@collabora.co.uk> - 2017-09-21 18:20 +0200
    Re: [PATCH v3 2/6] serial: imx: only set dma_is_rxing when DMA starts Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-09-21 20:20 +0200

#1736821 — [PATCH v3 2/6] serial: imx: only set dma_is_rxing when DMA starts

FromMartyn Welch <martyn.welch@collabora.co.uk>
Date2017-09-21 18:20 +0200
Subject[PATCH v3 2/6] serial: imx: only set dma_is_rxing when DMA starts
Message-ID<uscmJ-3iX-1@gated-at.bofh.it>
From: Romain Perier <romain.perier@collabora.com>

The variable dma_is_rxing is currently set to 1 in imx_disable_rx_int().
This is problematic as:

- whilst imx_disable_rx_int() is currently always called before
  start_rx_dma() this dependency isn't obvious.
- start_rx_dma() does error checking and might exit without
  enabling DMA. Currently this will result in dma_is_rxing suggesting
  that DMA is being used for recieving.

To avoid these issues, move the setting of dma_is_rxing to
start_rx_dma() when appropriate.

Signed-off-by: Romain Perier <romain.perier@collabora.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
---
 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 d90dae3..7835279 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -714,8 +714,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);
@@ -1074,6 +1072,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

[toc] | [next] | [standalone]


#1736991

FromUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date2017-09-21 20:20 +0200
Message-ID<useeR-4od-5@gated-at.bofh.it>
In reply to#1736821
On Thu, Sep 21, 2017 at 05:18:13PM +0100, Martyn Welch wrote:
> From: Romain Perier <romain.perier@collabora.com>
> 
> The variable dma_is_rxing is currently set to 1 in imx_disable_rx_int().
> This is problematic as:
> 
> - whilst imx_disable_rx_int() is currently always called before
>   start_rx_dma() this dependency isn't obvious.
> - start_rx_dma() does error checking and might exit without
>   enabling DMA. Currently this will result in dma_is_rxing suggesting
>   that DMA is being used for recieving.
> 
> To avoid these issues, move the setting of dma_is_rxing to
> start_rx_dma() when appropriate.
> 
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web