From patchwork Mon May 14 16:18:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10398871 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 E9F526038F for ; Mon, 14 May 2018 16:21:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D67592841D for ; Mon, 14 May 2018 16:21:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C054628449; Mon, 14 May 2018 16:21:19 +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=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 1D5C828446 for ; Mon, 14 May 2018 16:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755005AbeENQVF (ORCPT ); Mon, 14 May 2018 12:21:05 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:52969 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754987AbeENQVB (ORCPT ); Mon, 14 May 2018 12:21:01 -0400 Received: by mail-wm0-f66.google.com with SMTP id w194-v6so14511620wmf.2 for ; Mon, 14 May 2018 09:21:00 -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=YXQxSkq4VxPN8xd48JJjkNFWvrP3jl7yjYc0HnnBGhw=; b=CUHuv6I/5e+oDbsAwvs8nrETojjkGlb2Cj6pLBS0+ybL0uHPn3Mxd58S2lJ1VPLcYU j7//M6Lh1MITFvHgdQQI/1+J+S7N413i37lZCNiTq0xcDFwIJ2OT0haFk01tmqt/zpv3 pmJZIA0CIl5x0ImBQHpk2tOXgiFScKobmjJ1U= 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=YXQxSkq4VxPN8xd48JJjkNFWvrP3jl7yjYc0HnnBGhw=; b=CQjLeqQWpNXyfBL0KKzYLXikbk/SlW0tkF/IZuite0eTjxN+4E9kpybysQf+93S/UO gOu0IXJzG/N3rOeaor/1uqH4s1bYaVQms402dxHJE9AugMR2kpjNyYm2+OiocGltt0sR QYIwT4QE8VA+g/JBkPMWpNcpWz0coq9Vyy9NU9hXEXgrrEU9wLPftvaTZ4CKtgciA0PF h5WoztGIQCohNrt3MPaePwNHqerBdH1mNBZJH1uww21jTqs8wKa/0W3SHX6twXL4fXXA CVyOpg8FYAPlo3KmxEjAwLWyx7rXCoh7AEywhOo3Sl7kYojyhmoUE4Q1bSuKlFfrc6C5 3I+w== X-Gm-Message-State: ALKqPweiEqfJzbNwqmyjBJFQXUOxVxrQst+itZt1X3k0Ev3RuPnQDSOs 9S3xfGvrH/j4KlU4jyMqMXcLew== X-Google-Smtp-Source: AB8JxZp9y9Z+GpuYMRBPgfy5XRzy6UlDKh0t7qqBXAM7Hr+8+mpVseKnOwMZXUgB2LKMntqfxGFclw== X-Received: by 2002:a1c:af8a:: with SMTP id y132-v6mr5827941wme.107.1526314859424; Mon, 14 May 2018 09:20:59 -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 p7-v6sm11231468wrj.85.2018.05.14.09.20.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 May 2018 09:20:58 -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] dmaengine: qcom: bam_dma: check if the runtime pm enabled Date: Mon, 14 May 2018 17:18:52 +0100 Message-Id: <20180514161852.9620-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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index d29275b97e84..5f4babebc508 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -540,7 +540,7 @@ static void bam_free_chan(struct dma_chan *chan) int ret; ret = pm_runtime_get_sync(bdev->dev); - if (ret < 0) + if (pm_runtime_enabled(bdev->dev) && ret < 0) return; vchan_free_chan_resources(to_virt_chan(chan)); @@ -721,7 +721,7 @@ static int bam_pause(struct dma_chan *chan) int ret; ret = pm_runtime_get_sync(bdev->dev); - if (ret < 0) + if (pm_runtime_enabled(bdev->dev) && ret < 0) return ret; spin_lock_irqsave(&bchan->vc.lock, flag); @@ -747,7 +747,7 @@ static int bam_resume(struct dma_chan *chan) int ret; ret = pm_runtime_get_sync(bdev->dev); - if (ret < 0) + if (pm_runtime_enabled(bdev->dev) && ret < 0) return ret; spin_lock_irqsave(&bchan->vc.lock, flag); @@ -853,7 +853,7 @@ static irqreturn_t bam_dma_irq(int irq, void *data) tasklet_schedule(&bdev->task); ret = pm_runtime_get_sync(bdev->dev); - if (ret < 0) + if (pm_runtime_enabled(bdev->dev) && ret < 0) return ret; if (srcs & BAM_IRQ) { @@ -970,7 +970,7 @@ static void bam_start_dma(struct bam_chan *bchan) return; ret = pm_runtime_get_sync(bdev->dev); - if (ret < 0) + if (pm_runtime_enabled(bdev->dev) && ret < 0) return; while (vd && !IS_BUSY(bchan)) {