From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Date: Fri, 18 Sep 2015 11:08:31 +0000 Subject: [PATCH v4 08/10] serial: sh-sci: Do not terminate DMA engine when race condition occurs Message-Id: <1442574513-20648-9-git-send-email-geert+renesas@glider.be> List-Id: References: <1442574513-20648-1-git-send-email-geert+renesas@glider.be> In-Reply-To: <1442574513-20648-1-git-send-email-geert+renesas@glider.be> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Greg Kroah-Hartman , Jiri Slaby Cc: Muhammad Hamza Farooq , Magnus Damm , Yoshihiro Shimoda , Laurent Pinchart , Nobuhiro Iwamatsu , Yoshihiro Kaneko , Kazuya Mizuguchi , Koji Matsuoka , Wolfram Sang , Guennadi Liakhovetski , linux-serial@vger.kernel.org, linux-sh@vger.kernel.org, Geert Uytterhoeven From: Muhammad Hamza Farooq When DMA packet completion and timer expiry take place at the same time, do not terminate the DMA engine, leading by submission of new descriptors, as the DMA communication hasn't necessarily stopped here. Signed-off-by: Muhammad Hamza Farooq Signed-off-by: Geert Uytterhoeven --- v4: - New. --- drivers/tty/serial/sh-sci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 84c15152e111b084..9406fe227bc76c96 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1296,9 +1296,14 @@ static void rx_timer_fn(unsigned long arg) } status = dmaengine_tx_status(s->chan_rx, s->active_rx, &state); - if (status = DMA_COMPLETE) + if (status = DMA_COMPLETE) { dev_dbg(port->dev, "Cookie %d #%d has already completed\n", s->active_rx, active); + spin_unlock_irqrestore(&port->lock, flags); + + /* Let packet complete handler take care of the packet */ + return; + } /* Handle incomplete DMA receive */ dmaengine_terminate_all(s->chan_rx); -- 1.9.1