linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Vinod <vkoul@kernel.org>
Cc: agross@codeaurora.org, dmaengine@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] dmaengine: qcom: bam_dma: check if the runtime pm enabled
Date: Thu, 17 May 2018 10:20:51 +0100	[thread overview]
Message-ID: <2136d6a5-c039-d319-0d32-b0f6ef81e4e0@linaro.org> (raw)
In-Reply-To: <20180517052107.GT13271@vkoul-mobl>



On 17/05/18 06:21, Vinod wrote:
> On 14-05-18, 17:18, Srinivas Kandagatla wrote:
>> 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 <srinivas.kandagatla@linaro.org>
>> ---
>>   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)
> 
> would it make sense to first check enabled and do _get_sync()
>
Both of them check the disable_depth, however doing it the way you 
suggested would avoid some additional calls.

>          if (pm_runtime_enabled()) {
>                  ret = pm_runtime_get_sync() {
>                  ...
>                  }
>          }
sound like good idea!
> 
Just noticed that some of the drivers use:

         err = pm_runtime_get_sync(dev);
         if (err < 0 && err !=-EACCES)
		return;

others warp up this into local function.

Will send a v2!


thanks,
srini

> thus making clear in code that we do calls only when it is enabled. Also you can
> add a local macro for this code and use that rather than copy pasting :)
> 

      reply	other threads:[~2018-05-17  9:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14 16:18 [PATCH] dmaengine: qcom: bam_dma: check if the runtime pm enabled Srinivas Kandagatla
2018-05-17  5:21 ` Vinod
2018-05-17  9:20   ` Srinivas Kandagatla [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2136d6a5-c039-d319-0d32-b0f6ef81e4e0@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=agross@codeaurora.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).