[PATCH AUTOSEL 5.1 07/51] ASoC: soc-dpm: fixup DAI active unbalance

Sasha Levin
2019-06-26T03:41:38Z

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

[ Upstream commit f7c4842abfa1a219554a3ffd8c317e8fdd979bec ]

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>
Signed-off-by: Sasha Levin <sashal@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 5d9d7678e4fa..1ee67716d558 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3831,8 +3831,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;
@@ -3853,8 +3853,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;
--
2.20.1