From patchwork Thu Sep 21 16:18:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Martyn Welch X-Patchwork-Id: 9964243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C750F6020C for ; Thu, 21 Sep 2017 16:19:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B407329541 for ; Thu, 21 Sep 2017 16:19:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8DE729550; Thu, 21 Sep 2017 16:19:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4B68529541 for ; Thu, 21 Sep 2017 16:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=V4toe/UtNZ8vLUge0oOqsQBmaNMVVmQoug3gQ5NvQVk=; b=m2juESMlE4m49ndeeMjQd+hbm6 L5ppwQEOjK4gktPve4wsRoZmw73jK3yuRWa1kj9TwCXFQHbAwLi+bLyyjUTd/tLiuAykjelqN/AjK X/OY4SoLECkKsGE5uUVn/4Bs5h+11UNO1q0edRpRAAQZZUGaQT9URm1Xuhw/bBErssJLmGHlJN0m9 U7FLXFGQpxEvf73Wzz9B0T+vtD3dWS4jV4EhAgKuXHAVByq4fD3rwBaItY5euQ8DQYk6aAtK1+XaV VRmalabng108jL5i6L3M3ENVfA3ZLKh5iG3N6lPURdcUU/iwGfI7MiB3HCQH0d+PkivcrQqyv4/IB ol5jBTWA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dv4C9-00035F-Sv; Thu, 21 Sep 2017 16:19:21 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dv4Bh-0002PB-Nv for linux-arm-kernel@lists.infradead.org; Thu, 21 Sep 2017 16:18:56 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: martyn) with ESMTPSA id 273EC260870 Received: by kratos.localdomain (Postfix, from userid 1000) id D7667204D84BA; Thu, 21 Sep 2017 17:18:22 +0100 (BST) From: Martyn Welch To: Greg Kroah-Hartman Subject: [PATCH v3 2/6] serial: imx: only set dma_is_rxing when DMA starts Date: Thu, 21 Sep 2017 17:18:13 +0100 Message-Id: <1506010697-22114-3-git-send-email-martyn.welch@collabora.co.uk> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1506010697-22114-1-git-send-email-martyn.welch@collabora.co.uk> References: <1506010697-22114-1-git-send-email-martyn.welch@collabora.co.uk> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170921_091854_073042_58BC2358 X-CRM114-Status: GOOD ( 10.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Martyn Welch , Nandor Han , linux-kernel@vger.kernel.org, Fabio Estevam , linux-serial@vger.kernel.org, u.kleine-koenig@pengutronix.de, Romain Perier , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Romain Perier 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 Signed-off-by: Martyn Welch Reviewed-by: Uwe Kleine-König --- 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;