From: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: alsa-devel@alsa-project.org,
"Rafael J. Wysocki" <rafael@kernel.org>,
tiwai@suse.de, gregkh@linuxfoundation.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
vkoul@kernel.org, broonie@kernel.org,
srinivas.kandagatla@linaro.org, jank@cadence.com,
slawomir.blauciak@intel.com,
Sanyog Kale <sanyog.r.kale@intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [alsa-devel] [RFC PATCH 17/40] soundwire: bus: use runtime_pm_get_sync/pm when enabled
Date: Fri, 26 Jul 2019 20:25:35 +0200 [thread overview]
Message-ID: <20190726182534.GO16003@ubuntu> (raw)
In-Reply-To: <45a912c5-134b-8642-70ef-8c1060389300@linux.intel.com>
On Fri, Jul 26, 2019 at 01:08:57PM -0500, Pierre-Louis Bossart wrote:
> This thread became unreadable with interleaved top-posting, allow me restate
> the options and ask PM folks what they think
>
> On 7/25/19 6:40 PM, Pierre-Louis Bossart wrote:
> > Not all platforms support runtime_pm for now, let's use runtime_pm
> > only when enabled.
> >
> > Suggested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> > Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> > ---
> > drivers/soundwire/bus.c | 25 ++++++++++++++++---------
> > 1 file changed, 16 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
> > index 5ad4109dc72f..0a45dc5713df 100644
> > --- a/drivers/soundwire/bus.c
> > +++ b/drivers/soundwire/bus.c
> > @@ -332,12 +332,16 @@ 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);
> > + if (ret < 0)
> > + return ret;
> > + }
> > ret = sdw_transfer(slave->bus, &msg);
> > - pm_runtime_put(slave->bus->dev);
> > +
> > + if (pm_runtime_enabled(slave->bus->dev))
> > + pm_runtime_put(slave->bus->dev);
>
> This is option1: we explicitly test if pm_runtime is enabled before calling
> _get_sync() and _put()
>
> option2 (suggested by Jan Kotas): catch the -EACCESS error code
>
> ret = pm_runtime_get_sync(slave->bus->dev);
> - if (ret < 0)
> + if (ret < 0 && ret != -EACCES)
> return ret;
>
> option3: ignore the return value as done in quite a few drivers
>
> Are there any other options? I am personally surprised this is not handled
> in the pm_runtime core, not sure why users need to test for this?
option 4: fix this in runtime PM :-) This seems like the best option to me,
but probably not the easiest one. Otherwise I'd go with (2), I think, since
that's also the official purpose of the -EACCESS return code:
https://lists.linuxfoundation.org/pipermail/linux-pm/2011-June/031930.html
Thanks
Guennadi
next prev parent reply other threads:[~2019-07-26 18:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com>
[not found] ` <20190725234032.21152-18-pierre-louis.bossart@linux.intel.com>
2019-07-26 18:08 ` [RFC PATCH 17/40] soundwire: bus: use runtime_pm_get_sync/pm when enabled Pierre-Louis Bossart
2019-07-26 18:25 ` Guennadi Liakhovetski [this message]
2019-07-26 19:11 ` [alsa-devel] " Andy Shevchenko
2019-07-26 19:08 ` Andy Shevchenko
2019-07-29 22:07 ` [alsa-devel] " Pierre-Louis Bossart
2019-07-30 11:21 ` Andy Shevchenko
2019-07-30 12:57 ` Pierre-Louis Bossart
2019-07-30 15:58 ` Andy Shevchenko
2019-07-30 15:59 ` Andy Shevchenko
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=20190726182534.GO16003@ubuntu \
--to=guennadi.liakhovetski@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jank@cadence.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=rafael@kernel.org \
--cc=sanyog.r.kale@intel.com \
--cc=slawomir.blauciak@intel.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.de \
--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).