* [PATCH] ASoC: arizona: Exit startup early if no runtime
@ 2015-12-29 9:49 Charles Keepax
0 siblings, 0 replies; 4+ messages in thread
From: Charles Keepax @ 2015-12-29 9:49 UTC (permalink / raw)
To: broonie; +Cc: alsa-devel, patches, lgirdwood
commit 9b8ef9f6b3fc ("ASoC: dapm: Add startup & shutdown for dai_links")
Added support for calling startup on CODEC to CODEC links, however this
is called with a NULL runtime pointer. There isn't really a sensible way
to pass a valid runtime pointer to a CODEC to CODEC link at the moment,
so we need to make the startup function safe for NULL runtimes.
This patch returns from the Arizona startup function early if there is no
runtime, this is perfectly safe as all the startup function does is set
the PCM constraints for user-space which arn't relevant to a CODEC to
CODEC link anyway.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
sound/soc/codecs/arizona.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index fb8f188..33143fe 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1494,6 +1494,9 @@ static int arizona_startup(struct snd_pcm_substream *substream,
const struct snd_pcm_hw_constraint_list *constraint;
unsigned int base_rate;
+ if (!substream->runtime)
+ return 0;
+
switch (dai_priv->clk) {
case ARIZONA_CLK_SYSCLK:
base_rate = priv->sysclk;
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH] ASoC: arizona: Exit startup early if no runtime
@ 2015-12-23 12:48 Charles Keepax
2015-12-24 19:41 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Charles Keepax @ 2015-12-23 12:48 UTC (permalink / raw)
To: broonie; +Cc: vinod.koul, jeeja.kp, alsa-devel, patches, lgirdwood
commit 9b8ef9f6b3fc ("ASoC: dapm: Add startup & shutdown for dai_links")
Added support for calling startup on CODEC to CODEC links, however this
is called with a NULL runtime pointer. There isn't really a sensible way
to pass a valid runtime pointer to a CODEC to CODEC link at the moment,
so we need to make the startup function safe for NULL runtimes. This
patch returns from the Arizona startup function early if there is no
runtime.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
I will fixup the other users as well if everyone is happy
with this approach?
Thanks,
Charles
sound/soc/codecs/arizona.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 38a73e3..88e2c74 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1494,6 +1494,9 @@ static int arizona_startup(struct snd_pcm_substream *substream,
const struct snd_pcm_hw_constraint_list *constraint;
unsigned int base_rate;
+ if (!substream->runtime)
+ return 0;
+
switch (dai_priv->clk) {
case ARIZONA_CLK_SYSCLK:
base_rate = priv->sysclk;
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] ASoC: arizona: Exit startup early if no runtime
2015-12-23 12:48 Charles Keepax
@ 2015-12-24 19:41 ` Mark Brown
2015-12-29 9:46 ` Charles Keepax
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2015-12-24 19:41 UTC (permalink / raw)
To: Charles Keepax; +Cc: vinod.koul, jeeja.kp, alsa-devel, patches, lgirdwood
[-- Attachment #1.1: Type: text/plain, Size: 753 bytes --]
On Wed, Dec 23, 2015 at 12:48:01PM +0000, Charles Keepax wrote:
> commit 9b8ef9f6b3fc ("ASoC: dapm: Add startup & shutdown for dai_links")
>
> Added support for calling startup on CODEC to CODEC links, however this
> is called with a NULL runtime pointer. There isn't really a sensible way
> to pass a valid runtime pointer to a CODEC to CODEC link at the moment,
> so we need to make the startup function safe for NULL runtimes. This
> patch returns from the Arizona startup function early if there is no
> runtime.
We need a bit more here about why it's safe to just skip this code - it
is actually safe since we're just setting constraints for userspace but
that's not something the reader can tell without looking for more
context.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ASoC: arizona: Exit startup early if no runtime
2015-12-24 19:41 ` Mark Brown
@ 2015-12-29 9:46 ` Charles Keepax
0 siblings, 0 replies; 4+ messages in thread
From: Charles Keepax @ 2015-12-29 9:46 UTC (permalink / raw)
To: Mark Brown; +Cc: vinod.koul, jeeja.kp, alsa-devel, patches, lgirdwood
On Thu, Dec 24, 2015 at 07:41:05PM +0000, Mark Brown wrote:
> On Wed, Dec 23, 2015 at 12:48:01PM +0000, Charles Keepax wrote:
> > commit 9b8ef9f6b3fc ("ASoC: dapm: Add startup & shutdown for dai_links")
> >
> > Added support for calling startup on CODEC to CODEC links, however this
> > is called with a NULL runtime pointer. There isn't really a sensible way
> > to pass a valid runtime pointer to a CODEC to CODEC link at the moment,
> > so we need to make the startup function safe for NULL runtimes. This
> > patch returns from the Arizona startup function early if there is no
> > runtime.
>
> We need a bit more here about why it's safe to just skip this code - it
> is actually safe since we're just setting constraints for userspace but
> that's not something the reader can tell without looking for more
> context.
Yeah no problem I will respin and send out a new version today.
Thanks,
Charles
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-12-29 9:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-29 9:49 [PATCH] ASoC: arizona: Exit startup early if no runtime Charles Keepax
-- strict thread matches above, loose matches on Subject: below --
2015-12-23 12:48 Charles Keepax
2015-12-24 19:41 ` Mark Brown
2015-12-29 9:46 ` Charles Keepax
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox