OSDN Git Service

ASoC: soc-dapm: use snd_soc_dai_activate()/deactivate()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Fri, 15 May 2020 00:46:33 +0000 (09:46 +0900)
committerMark Brown <broonie@kernel.org>
Mon, 18 May 2020 15:15:00 +0000 (16:15 +0100)
soc-dapm.c :: snd_soc_dai_link_event_pre_pmu() / snd_soc_dai_link_event()
are directly updating dai->active without caring about
stream_active / component->active.
It is breaking xxx_active count balance.
This patch uses snd_soc_dai_action() for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/878shu6n4n.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-dapm.c

index 80658d1..a4de3e4 100644 (file)
@@ -3835,7 +3835,7 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
                                "ASoC: startup() failed: %d\n", ret);
                        goto out;
                }
-               source->active++;
+               snd_soc_dai_activate(source, substream->stream);
        }
 
        substream->stream = SNDRV_PCM_STREAM_PLAYBACK;
@@ -3848,7 +3848,7 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
                                "ASoC: startup() failed: %d\n", ret);
                        goto out;
                }
-               sink->active++;
+               snd_soc_dai_activate(sink, substream->stream);
        }
 
        substream->hw_opened = 1;
@@ -3978,14 +3978,14 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
                substream->stream = SNDRV_PCM_STREAM_CAPTURE;
                snd_soc_dapm_widget_for_each_source_path(w, path) {
                        source = path->source->priv;
-                       source->active--;
+                       snd_soc_dai_deactivate(source, substream->stream);
                        snd_soc_dai_shutdown(source, substream);
                }
 
                substream->stream = SNDRV_PCM_STREAM_PLAYBACK;
                snd_soc_dapm_widget_for_each_sink_path(w, path) {
                        sink = path->sink->priv;
-                       sink->active--;
+                       snd_soc_dai_deactivate(sink, substream->stream);
                        snd_soc_dai_shutdown(sink, substream);
                }
                break;