Message ID | 1450874881-31458-1-git-send-email-ckeepax@opensource.wolfsonmicro.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 26eb5a9a6a8545ebb9d45de9e6d43e511b250839 |
Headers | show |
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.
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
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;
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(+)