From patchwork Thu Oct 6 19:33:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 9365255 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 2B873600C8 for ; Thu, 6 Oct 2016 19:33:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F679290F6 for ; Thu, 6 Oct 2016 19:33:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02742291E9; Thu, 6 Oct 2016 19:33: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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A242290F6 for ; Thu, 6 Oct 2016 19:33:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934676AbcJFTd1 (ORCPT ); Thu, 6 Oct 2016 15:33:27 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39922 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932291AbcJFTd0 (ORCPT ); Thu, 6 Oct 2016 15:33:26 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id EC66961AF6; Thu, 6 Oct 2016 19:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1475782406; bh=pVZXcHiU7k+pUBB7XpwRQwaHCBVVTR7z9etR3zeahRA=; h=From:To:Cc:Subject:Date:From; b=YLh31QHMSzEfgKtTEP0lK4RlokGzCRDB0dPtPsgccS0C+TZGF8OoZGb+NFTJdjHAx Qsrz8lDzWpJAtKcTCTXyMTXM8kUEtV+sSaFOv5ZrVdALJ5myOiCYhwLvuV82EvCWWh 2DZ7x0jaK+QCEKX5rllYXohiEVFDPecD9Ipm5Y0A= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id B6F1661AEE; Thu, 6 Oct 2016 19:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1475782405; bh=pVZXcHiU7k+pUBB7XpwRQwaHCBVVTR7z9etR3zeahRA=; h=From:To:Cc:Subject:Date:From; b=AhRdxa02OFivvvy50+daXm+i/13VCAlU0MUgBhZNgwDu5rFsuBokXhRB4Wow2FsgF SQ6jMs6+aOn9pUhSM1OQqTrb7Om0IYEvN8VZYPUi8plQmRar+hnSSuLhTn0Z1h5AYe aPcVtHSVMP043wUGkevwECuJftZ5ghC7SSoY2ZOI= DMARC-Filter: OpenDMARC Filter v1.3.1 smtp.codeaurora.org B6F1661AEE Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=pass smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: dmaengine@vger.kernel.org, timur@codeaurora.org, cov@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , linux-kernel@vger.kernel.org Subject: [PATCH] dmaengine: qcom_hidma: prevent disable in error Date: Thu, 6 Oct 2016 15:33:14 -0400 Message-Id: <1475782394-27887-1-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When an error is observed, we try to disable the channel and prevent further accesses from the client. Depending on the type of error, transitioning into disabled state might not be possible. Adding a check to make sure that HW is in enabled/running state before the disable transition happens. Signed-off-by: Sinan Kaya --- drivers/dma/qcom/hidma_ll.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/dma/qcom/hidma_ll.c b/drivers/dma/qcom/hidma_ll.c index 3224f24..c3a66c9 100644 --- a/drivers/dma/qcom/hidma_ll.c +++ b/drivers/dma/qcom/hidma_ll.c @@ -564,19 +564,8 @@ int hidma_ll_disable(struct hidma_lldev *lldev) u32 val; int ret; - val = readl(lldev->evca + HIDMA_EVCA_CTRLSTS_REG); - lldev->evch_state = HIDMA_CH_STATE(val); - val = readl(lldev->trca + HIDMA_TRCA_CTRLSTS_REG); - lldev->trch_state = HIDMA_CH_STATE(val); - - /* already suspended by this OS */ - if ((lldev->trch_state == HIDMA_CH_SUSPENDED) || - (lldev->evch_state == HIDMA_CH_SUSPENDED)) - return 0; - - /* already stopped by the manager */ - if ((lldev->trch_state == HIDMA_CH_STOPPED) || - (lldev->evch_state == HIDMA_CH_STOPPED)) + /* The channel needs to be in working state */ + if (!hidma_ll_isenabled(lldev)) return 0; val = readl(lldev->trca + HIDMA_TRCA_CTRLSTS_REG);