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: 10406219 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 1A3D860230 for ; Thu, 17 May 2018 09:45:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A44928A0D for ; Thu, 17 May 2018 09:45:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F124628A16; Thu, 17 May 2018 09:45:01 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable 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 78BEC28A0D for ; Thu, 17 May 2018 09:45:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751293AbeEQJos (ORCPT ); Thu, 17 May 2018 05:44:48 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:38030 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751017AbeEQJor (ORCPT ); Thu, 17 May 2018 05:44:47 -0400 Received: by mail-wm0-f68.google.com with SMTP id m129-v6so7783860wmb.3 for ; Thu, 17 May 2018 02:44:46 -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=pyNwntOuxlbbU86kNuvFtnf8L3aovhf6pJKACXXROxfMqDBRw7wpPbETR/b5H2C4th Qr/KgUBf1GP0BctFLXdaoYgHTcwtreH2uS8jbg/9nlv2qXcyNRTaN4JghmbpsUtDnOGZ yZi/o3ClmnazyykEjH6SFDjzPCa9ioOmKRPzbjimZYKNP3ytVvzBUAs+dq2V4/18hogu Jw64qeDybQApmdIS6VRCvLIIL/XPeFly9+UyCDmgMhsGiMctXNyLH3vRlVn0sb4CllBm mu34pn32C22NUVf0snb109pPka771OyI2Vz9hX748F50B6OCI26o+StZAErMtUOLS+MB PDdQ== X-Gm-Message-State: ALKqPwfFox1nHkipODFwHJ+3uz49lNpNKfz7B1d7X7TRXBB1MNnoArg9 T+ydOjccXfX2QWAwzcd4bALgaA== 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 Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Srinivas Kandagatla 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 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.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;