linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/7] serial: imx: only set DMA rx-ing when DMA starts
Date: Mon, 3 Jul 2017 08:48:40 +0200	[thread overview]
Message-ID: <20170703064840.pttfudcv7xsnbki3@pengutronix.de> (raw)
In-Reply-To: <20170630120446.13994-2-romain.perier@collabora.com>

Hello,

On Fri, Jun 30, 2017 at 02:04:40PM +0200, Romain Perier wrote:
> 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.

Just from reading the commit log and the patch I didn't understand the
problem that is supposed to be fixed here. After looking at it for some
I understood. I don't suggest a new commit log here as it has to look
different if you pick up my comment below.

> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 5437b34..1d35293 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -725,11 +725,11 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> -static void imx_disable_rx_int(struct imx_port *sport)
> +static void imx_disable_rx_int(struct imx_port *sport, bool is_rxing)
>  {
>  	unsigned long temp;
>  
> -	sport->dma_is_rxing = 1;
> +	sport->dma_is_rxing = is_rxing;
>  
>  	/* disable the receiver ready and aging timer interrupts */
>  	temp = readl(sport->port.membase + UCR1);
> @@ -762,7 +762,7 @@ static void imx_dma_rxint(struct imx_port *sport)
>  	temp = readl(sport->port.membase + USR2);
>  	if ((temp & USR2_RDR) && !sport->dma_is_rxing) {
>  
> -		imx_disable_rx_int(sport);
> +		imx_disable_rx_int(sport, false);
>  
>  		/* tell the DMA to receive the data. */
>  		start_rx_dma(sport);
> @@ -1083,6 +1083,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;
> @@ -1362,7 +1363,7 @@ static int imx_startup(struct uart_port *port)
>  		spin_unlock(&tty->files_lock);
>  
>  		if (readcnt > 0) {
> -			imx_disable_rx_int(sport);
> +			imx_disable_rx_int(sport, true);

I wonder if it would be saner to not assign to dma_is_rxing in
imx_disable_rx_int() at all but do this only in start_rx_dma() and
imx_dma_rxint().

Best regards
Uwe

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

  reply	other threads:[~2017-07-03  6:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30 12:04 [PATCH 0/7] serial: imx: various improvements Romain Perier
2017-06-30 12:04 ` [PATCH 1/7] serial: imx: only set DMA rx-ing when DMA starts Romain Perier
2017-07-03  6:48   ` Uwe Kleine-König [this message]
2017-07-04  8:55     ` Romain Perier
2017-06-30 12:04 ` [PATCH 2/7] serial: imx: move log from error to debug type Romain Perier
2017-07-03  6:50   ` Uwe Kleine-König
2017-06-30 12:04 ` [PATCH 3/7] serial: imx: init dma_is_{rx|tx}ing variables Romain Perier
2017-06-30 12:13   ` Lothar Waßmann
2017-07-03  6:52     ` Uwe Kleine-König
2017-07-05 10:14       ` Romain Perier
2017-07-05 11:58         ` Uwe Kleine-König
2017-06-30 12:04 ` [PATCH 4/7] serial: imx: Simplify DMA disablement Romain Perier
2017-07-03  6:58   ` Uwe Kleine-König
2017-06-30 12:04 ` [PATCH 5/7] serial: imx: umap sg buffers when DMA channel is released Romain Perier
2017-07-03  7:01   ` Uwe Kleine-König
2017-06-30 12:04 ` [PATCH 6/7] serial: imx: update the stop rx,tx procedures Romain Perier
2017-07-03  7:03   ` Uwe Kleine-König
2017-06-30 12:04 ` [PATCH 7/7] serial: imx: Fix imx_shutdown procedure Romain Perier
2017-07-03  7:08   ` Uwe Kleine-König

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=20170703064840.pttfudcv7xsnbki3@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).