Skip to contentSkip to conversation

ASoC: arizona: Exit startup early if no runtime

PATCH In review Charles Keepax 2 participants 4 messages Dec 23, 2015 – Dec 30, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: arizona: Exit startup early if no runtime

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.

---

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(+)
sound/soc/codecs/arizona.c +3 -0
index 38a73e3..88e2c74 100644
@@ -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;
Signature · 1 line
2.1.4
maintainer
#1 lore raw
Quoted 8 lines · Charles Keepax

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.

#2 lore raw
Quoted 10 lines · Mark Brown
Quoted 8 lines · Charles Keepax

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.

Quoted 4 lines

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

maintainer
#3 lore raw

Applied "ASoC: arizona: Exit startup early if no runtime" to the asoc tree

In reply to Charles Keepax

The patch

ASoC: arizona: Exit startup early if no runtime

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 26eb5a9a6a8545ebb9d45de9e6d43e511b250839 Mon Sep 17 00:00:00 2001

From: Charles Keepax <[email protected]>
Date: Tue, 29 Dec 2015 09:49:19 +0000
Subject: [PATCH] ASoC: arizona: Exit startup early if no runtime

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.

---
 sound/soc/codecs/arizona.c | 3 +++
 1 file changed, 3 insertions(+)
sound/soc/codecs/arizona.c +3 -0
index 38a73e3da508..88e2c74f1d17 100644
@@ -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;
Signature · 1 line
2.6.2