alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	vkoul@kernel.org
Cc: sanyog.r.kale@intel.com, alsa-devel@alsa-project.org
Subject: Re: [PATCH 3/4] soundwire: bus: check if pm runtime is enabled before calling
Date: Fri, 05 Apr 2019 08:26:44 -0700	[thread overview]
Message-ID: <1b1f66581b4ec8acf94638191d90ce95e790a566.camel@linux.intel.com> (raw)
In-Reply-To: <e2522fa7-298e-9385-9686-7c3ce3c8a03b@linux.intel.com>

On Thu, 2019-03-28 at 09:55 -0400, Pierre-Louis Bossart wrote:
> On 3/28/19 9:41 AM, Srinivas Kandagatla wrote:
> > Check the device has pm runtime enabled before returning error.
> > 
> > Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> > ---
> >   drivers/soundwire/bus.c | 16 ++++++++++------
> >   1 file changed, 10 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
> > index 1cbfedfc20ef..101562a6fb0d 100644
> > --- a/drivers/soundwire/bus.c
> > +++ b/drivers/soundwire/bus.c
> > @@ -327,9 +327,11 @@ int sdw_nread(struct sdw_slave *slave, u32
> > addr, size_t count, u8 *val)
> >   	if (ret < 0)
> >   		return ret;
> >   
> > -	ret = pm_runtime_get_sync(slave->bus->dev);
> > -	if (ret < 0)
> > -		return ret;
> > +	if (pm_runtime_enabled(slave->bus->dev)) {
> > +		ret = pm_runtime_get_sync(slave->bus->dev);
> 
> Is this an recommended/accepted sequence in kernel circles? I did a 
> quick git grep and don't see anyone using this sort of tests.
Hi Srinivas/Pierre,

Sorry for the delayed reply.

The only instance where I have seen the pm_runtime_get_sync() fail is
not because pm_runtime was disabled. But it is because the power is
powered off when trying to do a pm_runtime_get_sync().

I'm not very familiar with the code in soundwire yet, but is it
possible that the pm_domain supplier has powered off the soundwire
device and would cause a failure in pm_runtime_get_sync()?

Thanks,
Ranjani

> 
> 
> > +		if (ret < 0)
> > +			return ret;
> > +	}
> >   
> >   	ret = sdw_transfer(slave->bus, &msg);
> >   	pm_runtime_put(slave->bus->dev);
> 
> and the weird thing is that you don't test for the put() case?
> 
> > @@ -355,9 +357,11 @@ int sdw_nwrite(struct sdw_slave *slave, u32
> > addr, size_t count, u8 *val)
> >   	if (ret < 0)
> >   		return ret;
> >   
> > -	ret = pm_runtime_get_sync(slave->bus->dev);
> > -	if (ret < 0)
> > -		return ret;
> > +	if (pm_runtime_enabled(slave->bus->dev)) {
> > +		ret = pm_runtime_get_sync(slave->bus->dev);
> > +		if (ret < 0)
> > +			return ret;
> > +	}
> >   
> >   	ret = sdw_transfer(slave->bus, &msg);
> >   	pm_runtime_put(slave->bus->dev);
> > 
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2019-04-05 15:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-28 13:41 [PATCH 0/4] soundwire: few trival fixes and cleanups Srinivas Kandagatla
2019-03-28 13:41 ` [PATCH 1/4] soundwire: add module_sdw_driver helper macro Srinivas Kandagatla
2019-03-29  5:38   ` Vinod Koul
2019-03-28 13:41 ` [PATCH 2/4] soundwire: cdns: fix check for number of messages Srinivas Kandagatla
2019-03-28 14:03   ` Pierre-Louis Bossart
2019-03-28 14:58     ` Srinivas Kandagatla
2019-03-29  3:51       ` Sanyog Kale
2019-03-29  5:54       ` Vinod Koul
2019-03-29 10:06         ` Srinivas Kandagatla
2019-03-28 13:41 ` [PATCH 3/4] soundwire: bus: check if pm runtime is enabled before calling Srinivas Kandagatla
2019-03-28 13:55   ` Pierre-Louis Bossart
2019-03-28 14:37     ` Srinivas Kandagatla
2019-03-29  5:58       ` Vinod Koul
2019-03-29 10:02         ` Srinivas Kandagatla
2019-04-05 15:26     ` Ranjani Sridharan [this message]
2019-03-28 13:41 ` [PATCH 4/4] soundwire: remove unused struct sdw_bus_conf definition Srinivas Kandagatla

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=1b1f66581b4ec8acf94638191d90ce95e790a566.camel@linux.intel.com \
    --to=ranjani.sridharan@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --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 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).