From patchwork Thu May 17 09:42:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10406221 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 1B4CB60155 for ; Thu, 17 May 2018 09:45:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A68528A0D for ; Thu, 17 May 2018 09:45:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F30FA28A13; Thu, 17 May 2018 09:45:08 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 6D41028A0D for ; Thu, 17 May 2018 09:45:08 +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: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:In-Reply-To: References:List-Owner; bh=6Nd4VQZGgh6rvfrgEDJuhAtVQawxWQGzp+n0b6QcGaM=; b=m2x C2Vu8nDva2QjERCpdOIT/3fAt90hX7j3As79RXfm+VMnRGqjodflFN19vR94750mZmbQ3VOX5ZBT9 Pkk1O8nzZ8g8+EaUHbMoVMTuX9IfO0up+gvNLiZ2sGV9EdyOfTZAADK1tvkRa0yqMvPOCVLL/5+Aq 9QkOMByIJ2yzOOQY1Aru6euuXJJ/AxCqrYVHIcmIyyOT7OpHGnDABclemdkfMK8RNWTpnsmyRbGjt CLC60hm3kaS8dHAcb4599D6e/VF9hV6fOLy5qMa8CNNA0ivHSEmRYnRksulrE0EgvHVemWi/iZ6a/ UbvLyp/CG6Fawl1MKpDaCZJHH0UR80w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJFT3-0002wE-PR; Thu, 17 May 2018 09:45:01 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJFT0-0002tz-6F for linux-arm-kernel@lists.infradead.org; Thu, 17 May 2018 09:44:59 +0000 Received: by mail-wm0-x243.google.com with SMTP id n10-v6so7798564wmc.1 for ; Thu, 17 May 2018 02:44:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=y02pYt9azmxxyqw5zhkbgQacMsocN8fLi1atJxdIkKw=; b=L2E457IV+SFAO+USCj4V0v3Zrra9TgxSqFvdjCyepjuBb0L0ivETF+zIoe69/f3Qh6 cKfai6O4XbQZ8R5mTXuAK7YK0AcRrURHYGueGel3NolQB/GZTWnmw5hJef81fX8jpZjw FODa2OwKnUGJACKpflWMrVqJxXp4LoM1giyys= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=y02pYt9azmxxyqw5zhkbgQacMsocN8fLi1atJxdIkKw=; b=Cl5pn+3EnbaU2hnKkJZprREBAWnuJ9rSJzSHu5gKG+c+PzA7Kc09o+3QP/feXXTUiW prYogX7dGQ0Syyduys2GHsZm9yDglor9S6OJkIAhh+p7Vw7HbQbK46sdOBLayQaLG99c fo5risCOE77LIyHWduQq7jQz2jS6AQlLF8l73Yth1l0qwtJjFjx0+WKtyrdp9VpYMLxe kZJQ0lTi1l+88c8V4NmbFsRvkHpzbqyym6uNLqtmmVFAML2V9p/Q20hpkwS+QzxVRgiJ gtbP04HxGxm+ROqJQfkIZaYsFaLfFZOo0Dz7vO80Nas3OZSfOWwG3NIuBVw5forpBsl7 rw4Q== X-Gm-Message-State: ALKqPwdTqFM8CZhLYvE7JzK/qIxvffidxCyfrN6W1mSbQNsG9HoUeAYI dvc74/LZvAwa+samhTgdljq6Rg== X-Google-Smtp-Source: AB8JxZpoM4A/HolRK4s+J9uGBOOU4Bxh8F6Nz1gPrA+lfZ/km8JdXg/D1ddluD89xGoE+yaDRwz4yg== X-Received: by 2002:a1c:9e90:: with SMTP id h138-v6mr1274422wme.33.1526550286348; Thu, 17 May 2018 02:44:46 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id d12-v6sm4913203wrg.2.2018.05.17.02.44.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 May 2018 02:44:45 -0700 (PDT) From: Srinivas Kandagatla To: agross@codeaurora.org, vkoul@kernel.org, dmaengine@vger.kernel.org Subject: [PATCH v2] dmaengine: qcom: bam_dma: check if the runtime pm enabled Date: Thu, 17 May 2018 10:42:32 +0100 Message-Id: <20180517094232.27924-1-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.16.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180517_024458_244081_FD2002D4 X-CRM114-Status: GOOD ( 12.75 ) 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: linux-arm-msm@vger.kernel.org, Srinivas Kandagatla , linux-kernel@vger.kernel.org, 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 Disabling pm runtime at probe is not sufficient to get BAM working on remotely controller instances. pm_runtime_get_sync() would return -EACCES in such cases. So check if runtime pm is enabled before returning error from bam functions. Fixes: 5b4a68952a89 ("dmaengine: qcom: bam_dma: disable runtime pm on remote controlled") Signed-off-by: Srinivas Kandagatla --- drivers/dma/qcom/bam_dma.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index d29275b97e84..4a828c18099a 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -524,6 +524,14 @@ static int bam_alloc_chan(struct dma_chan *chan) return 0; } +static int bam_pm_runtime_get_sync(struct device *dev) +{ + if (pm_runtime_enabled(dev)) + return pm_runtime_get_sync(dev); + + return 0; +} + /** * bam_free_chan - Frees dma resources associated with specific channel * @chan: specified channel @@ -539,7 +547,7 @@ static void bam_free_chan(struct dma_chan *chan) unsigned long flags; int ret; - ret = pm_runtime_get_sync(bdev->dev); + ret = bam_pm_runtime_get_sync(bdev->dev); if (ret < 0) return; @@ -720,7 +728,7 @@ static int bam_pause(struct dma_chan *chan) unsigned long flag; int ret; - ret = pm_runtime_get_sync(bdev->dev); + ret = bam_pm_runtime_get_sync(bdev->dev); if (ret < 0) return ret; @@ -746,7 +754,7 @@ static int bam_resume(struct dma_chan *chan) unsigned long flag; int ret; - ret = pm_runtime_get_sync(bdev->dev); + ret = bam_pm_runtime_get_sync(bdev->dev); if (ret < 0) return ret; @@ -852,7 +860,7 @@ static irqreturn_t bam_dma_irq(int irq, void *data) if (srcs & P_IRQ) tasklet_schedule(&bdev->task); - ret = pm_runtime_get_sync(bdev->dev); + ret = bam_pm_runtime_get_sync(bdev->dev); if (ret < 0) return ret; @@ -969,7 +977,7 @@ static void bam_start_dma(struct bam_chan *bchan) if (!vd) return; - ret = pm_runtime_get_sync(bdev->dev); + ret = bam_pm_runtime_get_sync(bdev->dev); if (ret < 0) return;