All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Jan Kotas <jank@cadence.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"vkoul@kernel.org" <vkoul@kernel.org>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	"sanyog.r.kale@intel.com" <sanyog.r.kale@intel.com>
Subject: Re: [alsa-devel] [PATCH] soundwire: fix pm_runtime_get_sync return code checks
Date: Mon, 8 Apr 2019 12:43:47 -0500	[thread overview]
Message-ID: <ace7e7f7-c3bf-f38c-0e70-da826175e3c5@linux.intel.com> (raw)
In-Reply-To: <92538D7E-C628-40AC-AFE9-52C97B3BC42D@global.cadence.com>



On 4/8/19 2:12 AM, Jan Kotas wrote:
> 
> 
>> On 5 Apr 2019, at 17:04, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> wrote:
>>
>> On 4/5/19 2:26 AM, Jan Kotas wrote:
>>>
>>>   
>>>   	ret = pm_runtime_get_sync(slave->bus->dev);
>>> -	if (ret < 0)
>>> +	if (ret < 0 && ret != -EACCES)
>>>
>> There was a patch submitted on 3/28 by Srinivas Kandagatla who suggested an alternate solution for exactly the same code.
>>
>> +	if (pm_runtime_enabled(slave->bus->dev)) {
>> +		ret = pm_runtime_get_sync(slave->bus->dev);
>> +		if (ret < 0)
>> +			return ret;
>>
>> I am far from an expert on pm_runtime but Srinivas' solution looks more elegant to me.
> 
> Hello Pierre,
> 
> Please take a look at this patch, that was my inspiration:
> https://lists.linuxfoundation.org/pipermail/linux-pm/2011-June/031930.html

The two patches seems to be identical:

static inline bool pm_runtime_enabled(struct device *dev)
{
	return !dev->power.disable_depth;
}

static int rpm_resume()
[...]
else if (dev->power.disable_depth > 0)
		retval = -EACCES;


However I am still not clear on why this might fail.

I can only think of one possible explanation: there is no explicit 
pm_runtime_enable() in the soundwire code, so maybe the expectation is 
that the pm_runtime status is inherited from the parent (in the intel 
case the PCI driver), and that's missing in non-intel configurations?

> I also took a look, and it seems the value returned by
> pm_runtime_get_syncis simply ignored in a lot of places,
> so checking its value may be excessive.
But not checking seems careless at best...

  reply	other threads:[~2019-04-08 18:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-05  7:26 [PATCH] soundwire: fix pm_runtime_get_sync return code checks Jan Kotas
2019-04-05  7:26 ` Jan Kotas
2019-04-05 15:04 ` Pierre-Louis Bossart
2019-04-08  7:12   ` Jan Kotas
2019-04-08 17:43     ` Pierre-Louis Bossart [this message]
2019-04-12  8:29       ` Jan Kotas
2019-04-14 10:26       ` [alsa-devel] " Vinod Koul

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=ace7e7f7-c3bf-f38c-0e70-da826175e3c5@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=jank@cadence.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sanyog.r.kale@intel.com \
    --cc=srinivas.kandagatla@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.