summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2020-01-22 09:44:40 +0900
committerMark Brown <broonie@kernel.org>2020-01-23 12:19:47 +0000
commit0be429f9fcfccfbbbcdb40e154a5c2328da17ca9 (patch)
treee94462370e3d2e42a1255eeb2868f54e21d01241
parentf183f9277a0f16e340bbcb28bf30834652ef10e1 (diff)
downloadlinux-0be429f9fcfccfbbbcdb40e154a5c2328da17ca9.tar.bz2
ASoC: soc-pcm: add soc_rtd_shutdown()
Add soc_rtd_shutdown() to make the code easier to read Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/877e1kmi9z.wl-kuninori.morimoto.gx@renesas.com Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/soc-pcm.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index c0018293c67b..8095c64c4e3e 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -37,6 +37,14 @@ static int soc_rtd_startup(struct snd_soc_pcm_runtime *rtd,
return 0;
}
+static void soc_rtd_shutdown(struct snd_soc_pcm_runtime *rtd,
+ struct snd_pcm_substream *substream)
+{
+ if (rtd->dai_link->ops &&
+ rtd->dai_link->ops->shutdown)
+ rtd->dai_link->ops->shutdown(substream);
+}
+
/**
* snd_soc_runtime_activate() - Increment active count for PCM runtime components
* @rtd: ASoC PCM runtime that is activated
@@ -602,8 +610,7 @@ dynamic:
return 0;
config_err:
- if (rtd->dai_link->ops->shutdown)
- rtd->dai_link->ops->shutdown(substream);
+ soc_rtd_shutdown(rtd, substream);
machine_err:
i = rtd->num_codecs;
@@ -674,8 +681,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
for_each_rtd_codec_dai(rtd, i, codec_dai)
snd_soc_dai_shutdown(codec_dai, substream);
- if (rtd->dai_link->ops->shutdown)
- rtd->dai_link->ops->shutdown(substream);
+ soc_rtd_shutdown(rtd, substream);
soc_pcm_components_close(substream, NULL);