[alsa-devel] [PATCH][RFC] ASoC: soc-dpm: fixup DAI active unbalance
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
snd_soc_dai_link_event() is updating snd_soc_dai :: active, but it is unbalance. It counts up if it has startup callback.
case SND_SOC_DAPM_PRE_PMU: ... snd_soc_dapm_widget_for_each_source_path(w, path) { ... if (source->driver->ops->startup) { ... => source->active++; } ... } ...
But, always counts down
case SND_SOC_DAPM_PRE_PMD: ... snd_soc_dapm_widget_for_each_source_path(w, path) { ... => source->active--; ... }
This patch always counts up when SND_SOC_DAPM_PRE_PMD.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- Mark, Liam
I think this is bug, but I can't confirm it, because my driver need to have .startup. Thus, I added [RFC] on this patch. I'm happy if someone can confirm it.
sound/soc/soc-dapm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index c864502..147ad9d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3828,8 +3828,8 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, ret); goto out; } - source->active++; } + source->active++; ret = soc_dai_hw_params(&substream, params, source); if (ret < 0) goto out; @@ -3850,8 +3850,8 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, ret); goto out; } - sink->active++; } + sink->active++; ret = soc_dai_hw_params(&substream, params, sink); if (ret < 0) goto out;
On 5/16/19 8:21 PM, Kuninori Morimoto wrote:
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
snd_soc_dai_link_event() is updating snd_soc_dai :: active, but it is unbalance. It counts up if it has startup callback.
case SND_SOC_DAPM_PRE_PMU: ... snd_soc_dapm_widget_for_each_source_path(w, path) { ... if (source->driver->ops->startup) { ... => source->active++; } ... } ...
But, always counts down
case SND_SOC_DAPM_PRE_PMD: ... snd_soc_dapm_widget_for_each_source_path(w, path) { ... => source->active--; ... }
This patch always counts up when SND_SOC_DAPM_PRE_PMD.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Mark, Liam
I think this is bug, but I can't confirm it, because my driver need to have .startup. Thus, I added [RFC] on this patch. I'm happy if someone can confirm it.
This looks like a bug since the initial Intel contribution in 2015. 9b8ef9f6b3fc ('ASoC: dapm: Add startup & shutdown for dai_links') already has this imbalance.
I don't have a clue why this is not symmetric or not done as suggested by Morimoto-san. Vinod, any idea?
sound/soc/soc-dapm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index c864502..147ad9d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3828,8 +3828,8 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, ret); goto out; }
source->active++; }
source->active++; ret = soc_dai_hw_params(&substream, params, source); if (ret < 0) goto out;
@@ -3850,8 +3850,8 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, ret); goto out; }
sink->active++; }
sink->active++; ret = soc_dai_hw_params(&substream, params, sink); if (ret < 0) goto out;
On 16-05-19, 22:21, Pierre-Louis Bossart wrote:
On 5/16/19 8:21 PM, Kuninori Morimoto wrote:
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
snd_soc_dai_link_event() is updating snd_soc_dai :: active, but it is unbalance. It counts up if it has startup callback.
case SND_SOC_DAPM_PRE_PMU: ... snd_soc_dapm_widget_for_each_source_path(w, path) { ... if (source->driver->ops->startup) { ... => source->active++; } ... } ...
But, always counts down
case SND_SOC_DAPM_PRE_PMD: ... snd_soc_dapm_widget_for_each_source_path(w, path) { ... => source->active--; ... }
This patch always counts up when SND_SOC_DAPM_PRE_PMD.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Mark, Liam
I think this is bug, but I can't confirm it, because my driver need to have .startup. Thus, I added [RFC] on this patch. I'm happy if someone can confirm it.
Right, seems a bug to me!
This looks like a bug since the initial Intel contribution in 2015. 9b8ef9f6b3fc ('ASoC: dapm: Add startup & shutdown for dai_links') already has this imbalance.
Well yes this would be seen if someone has a dai_link without the startup and shutdown calls (which is not mandatory). Agreed that it was a miss to not put counters in right places.
I don't have a clue why this is not symmetric or not done as suggested by Morimoto-san. Vinod, any idea?
Since while testing we always had the calls and never run in imbalance, but we should have done better!
I think you should be able to test it on Intel platforms with dai_links and removing the optional calls.
The change looks fine to be
Reviewed-by: Vinod Koul vkoul@kernel.org
sound/soc/soc-dapm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index c864502..147ad9d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3828,8 +3828,8 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, ret); goto out; }
source->active++; }
source->active++; ret = soc_dai_hw_params(&substream, params, source); if (ret < 0) goto out;
@@ -3850,8 +3850,8 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, ret); goto out; }
sink->active++; }
sink->active++; ret = soc_dai_hw_params(&substream, params, sink); if (ret < 0) goto out;
The patch
ASoC: soc-dpm: fixup DAI active unbalance
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2
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
From f7c4842abfa1a219554a3ffd8c317e8fdd979bec Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Fri, 17 May 2019 10:21:12 +0900 Subject: [PATCH] ASoC: soc-dpm: fixup DAI active unbalance
snd_soc_dai_link_event() is updating snd_soc_dai :: active, but it is unbalance. It counts up if it has startup callback.
case SND_SOC_DAPM_PRE_PMU: ... snd_soc_dapm_widget_for_each_source_path(w, path) { ... if (source->driver->ops->startup) { ... => source->active++; } ... } ...
But, always counts down
case SND_SOC_DAPM_PRE_PMD: ... snd_soc_dapm_widget_for_each_source_path(w, path) { ... => source->active--; ... }
This patch always counts up when SND_SOC_DAPM_PRE_PMD.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Reviewed-by: Vinod Koul vkoul@kernel.org Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-dapm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 65ee0bb5dd0b..62e27defce56 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3828,8 +3828,8 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, ret); goto out; } - source->active++; } + source->active++; ret = soc_dai_hw_params(&substream, params, source); if (ret < 0) goto out; @@ -3850,8 +3850,8 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, ret); goto out; } - sink->active++; } + sink->active++; ret = soc_dai_hw_params(&substream, params, sink); if (ret < 0) goto out;
participants (4)
-
Kuninori Morimoto
-
Mark Brown
-
Pierre-Louis Bossart
-
Vinod Koul