From patchwork Fri Sep 18 11:08:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 7215151 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CAD059F32B for ; Fri, 18 Sep 2015 11:08:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 05E672095E for ; Fri, 18 Sep 2015 11:08:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F2CBA2095D for ; Fri, 18 Sep 2015 11:08:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753545AbbIRLIn (ORCPT ); Fri, 18 Sep 2015 07:08:43 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:54955 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753565AbbIRLIk (ORCPT ); Fri, 18 Sep 2015 07:08:40 -0400 Received: from ayla.of.borg ([84.195.106.123]) by baptiste.telenet-ops.be with bizsmtp id Jb8Y1r00y2fm56U01b8YxM; Fri, 18 Sep 2015 13:08:38 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1ZctWq-0001Vr-Fc; Fri, 18 Sep 2015 13:08:32 +0200 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1ZctWx-0005OR-3E; Fri, 18 Sep 2015 13:08:39 +0200 From: Geert Uytterhoeven 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 Subject: [PATCH v4 08/10] serial: sh-sci: Do not terminate DMA engine when race condition occurs Date: Fri, 18 Sep 2015 13:08:31 +0200 Message-Id: <1442574513-20648-9-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442574513-20648-1-git-send-email-geert+renesas@glider.be> References: <1442574513-20648-1-git-send-email-geert+renesas@glider.be> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);