ASoC: soc-dai: add snd_soc_dai_compr_shutdown()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 23 Apr 2020 23:15:28 +0000 (08:15 +0900)
committerMark Brown <broonie@kernel.org>
Wed, 29 Apr 2020 12:27:43 +0000 (13:27 +0100)
dai related function should be implemented at soc-dai.c.
This patch adds snd_soc_dai_compr_shutdown().

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/87o8rhssj3.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dai.h
sound/soc/soc-compress.c
sound/soc/soc-dai.c

index deb99b1..abf4ad2 100644 (file)
@@ -172,6 +172,8 @@ int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream,
 
 int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
                              struct snd_compr_stream *cstream);
+void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai,
+                               struct snd_compr_stream *cstream);
 
 struct snd_soc_dai_ops {
        /*
index 7960270..af74fb7 100644 (file)
@@ -114,8 +114,7 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
 machine_err:
        soc_compr_components_free(cstream, component);
 
-       if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown)
-               cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
+       snd_soc_dai_compr_shutdown(cpu_dai, cstream);
 out:
        mutex_unlock(&rtd->card->pcm_mutex);
 pm_err:
@@ -204,8 +203,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
 machine_err:
        soc_compr_components_free(cstream, component);
 open_err:
-       if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown)
-               cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
+       snd_soc_dai_compr_shutdown(cpu_dai, cstream);
 out:
        dpcm_path_put(&list);
 be_err:
@@ -244,8 +242,7 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
 
        soc_compr_components_free(cstream, NULL);
 
-       if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown)
-               cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
+       snd_soc_dai_compr_shutdown(cpu_dai, cstream);
 
        snd_soc_dapm_stream_stop(rtd, stream);
 
@@ -301,8 +298,7 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
 
        soc_compr_components_free(cstream, NULL);
 
-       if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown)
-               cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
+       snd_soc_dai_compr_shutdown(cpu_dai, cstream);
 
        mutex_unlock(&fe->card->mutex);
        return 0;
index 5c88f80..d5cb8b0 100644 (file)
@@ -517,3 +517,12 @@ int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
        return soc_dai_ret(dai, ret);
 }
 EXPORT_SYMBOL_GPL(snd_soc_dai_compr_startup);
+
+void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai,
+                               struct snd_compr_stream *cstream)
+{
+       if (dai->driver->cops &&
+           dai->driver->cops->shutdown)
+               dai->driver->cops->shutdown(cstream, dai);
+}
+EXPORT_SYMBOL_GPL(snd_soc_dai_compr_shutdown);