mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Romain Perier <romain.perier@collabora.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-serial@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Nandor Han <nandor.han@ge.com>,
	Romain Perier <romain.perier@collabora.com>
Subject: [PATCH v2 1/6] serial: imx: only set DMA rx-ing when DMA starts
Date: Wed,  5 Jul 2017 15:07:01 +0200	[thread overview]
Message-ID: <20170705130706.10388-2-romain.perier@collabora.com> (raw)
In-Reply-To: <20170705130706.10388-1-romain.perier@collabora.com>

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

  reply	other threads:[~2017-07-05 13:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-05 13:07 [PATCH v2 0/6] serial: imx: various improvements Romain Perier
2017-07-05 13:07 ` Romain Perier [this message]
2017-07-05 13:29   ` [PATCH v2 1/6] serial: imx: only set DMA rx-ing when DMA starts Uwe Kleine-König
2017-07-06  8:31     ` Romain Perier
2017-07-06 10:02       ` Uwe Kleine-König
2017-07-05 13:07 ` [PATCH v2 2/6] serial: imx: Simplify DMA disablement Romain Perier
2017-07-07  1:45   ` kbuild test robot
2017-07-05 13:07 ` [PATCH v2 3/6] serial: imx: remove CTSC and CTS handling Romain Perier
2017-07-05 13:38   ` Uwe Kleine-König
2017-07-05 14:42     ` Clemens Gruber
2017-09-15 20:57     ` Martyn Welch
2017-07-05 13:07 ` [PATCH v2 4/6] serial: imx: unmap sg buffers when DMA channel is released Romain Perier
2017-07-05 13:07 ` [PATCH v2 5/6] serial: imx: update the stop rx,tx procedures Romain Perier
2017-07-05 13:07 ` [PATCH v2 6/6] serial: imx: Fix imx_shutdown procedure Romain Perier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170705130706.10388-2-romain.perier@collabora.com \
    --to=romain.perier@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=nandor.han@ge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®