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: 136135 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2050397lji; Thu, 17 May 2018 02:44:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoNC03gQnefr7oumEbFgV9queKjWxulENs6shlVSCa2RiKB3SavrKpOWc2uV2LF3P3wosxK X-Received: by 2002:a62:c6d9:: with SMTP id x86-v6mr4522803pfk.192.1526550289572; Thu, 17 May 2018 02:44:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526550289; cv=none; d=google.com; s=arc-20160816; b=n3+SYCZWbyauHa4OdFZXYPB0ZqLsGL86f24ABNHb+W4V33ruqLCDtqPJBjgJ3xs05j kGb8kcLZwVqV9avALbrr8xbLQ1FXEuefjm0oV7CxRCN6nk802Ve93NOe6a46DLmp+St2 sbiRT5oMNpGTV5MM+lLi7KVPA46lz96qhjeCni3X2D1K4A4GXrdUslHFJQDGR7ISDPvv IX3axm29kCvg1X04XRQTWeDpa/5ZRihcrv15fYGYEkuKUzKX+P0bmi70Ydv8eq+UOQC/ YqavQcln2+fNc67D4u/R3jxsmBY9SnoTK/L0jTvlsncfWkqJV2GQ3fZOaFMuCehu87uu UR8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=EQz7jSfJyWeBxtxZJhYdFBDNW0y+CSyc7k3BS8OLxd0=; b=sr6QGFl8KS0AhCFtLar4h7JneilWwaTrRdJwGXBUbAkErDB3TQv0qruL+3kPY9Y8Hm MuJlw1qFVgjA4adW2DpRLNPwrh7TtMtHJ1Y1QeSitn3dDj3g2iwAzYmeOB7Kojh7sROz HXtLpcpnsgojThjWrpMWyJeeLHVqPJgvrpxblltQ0ktJhCQfOwOLzXZdhJC2z1Ebkjpc l/ziL7Pr46Z4YdVotcZ0NQrPbp9arK/UtSwZ5YDJvI9ir/BgJQE+jAx27BhU5mXROpNU 9pAIcLQQqTKtEnV0dwYVOxxR609SCvU6zmTg4dbQ6pHTDOXjwjitbbC3sQzFd38+5ZPC SR5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=L2E457IV; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k17-v6si4786713pfj.310.2018.05.17.02.44.49; Thu, 17 May 2018 02:44:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=L2E457IV; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751858AbeEQJos (ORCPT + 13 others); Thu, 17 May 2018 05:44:48 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:40422 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751293AbeEQJor (ORCPT ); Thu, 17 May 2018 05:44:47 -0400 Received: by mail-wm0-f66.google.com with SMTP id j5-v6so7796858wme.5 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=hDmkP3dyioxenRQY1jzwTdETZIyPWR9VjPjD/tMtO6evczoPttqritA2YTXQ33kRqq Bge23tdGGp8cpT9b2F3kh9XVKu6dYLZiKtdtZpISsTNGEG7LwZ1yvXQmZWM/7pWJNVdp x4UosLJIuYbWnpMaLlSkujf6KnV9ANkRLoVI2BpyXz7HXma5HrZ0SquuRmeXaapmY6fi 5RXPGJer3ppM3qtOhE6I9JJ2RnUeMKw+wBLgiW1ThSY0Ciumb1ScavbOJaEhZOlbsI2g Of0rMJzDhM8j+4o7UzFyz5Ujrd5VsvReV8nAydlu8L0tMMymCoP7HoPHq9d4HXkLeFWF Fk1g== X-Gm-Message-State: ALKqPwf+zj5G2uhw2DpRdu95gZYCa5NX12vEsn4Pn6qZxXYGi+CVPgYx KsF8ASkEfEvqj2uBvlkSzlFIqUl+dnM= 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: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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(-) -- 2.16.2 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;