Skip to content

Commit 0be429f

Browse files
morimotobroonie
authored andcommitted
ASoC: soc-pcm: add soc_rtd_shutdown()
Add soc_rtd_shutdown() to make the code easier to read Signed-off-by: Kuninori Morimoto <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ranjani Sridharan <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent f183f92 commit 0be429f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

sound/soc/soc-pcm.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ static int soc_rtd_startup(struct snd_soc_pcm_runtime *rtd,
3737
return 0;
3838
}
3939

40+
static void soc_rtd_shutdown(struct snd_soc_pcm_runtime *rtd,
41+
struct snd_pcm_substream *substream)
42+
{
43+
if (rtd->dai_link->ops &&
44+
rtd->dai_link->ops->shutdown)
45+
rtd->dai_link->ops->shutdown(substream);
46+
}
47+
4048
/**
4149
* snd_soc_runtime_activate() - Increment active count for PCM runtime components
4250
* @rtd: ASoC PCM runtime that is activated
@@ -602,8 +610,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
602610
return 0;
603611

604612
config_err:
605-
if (rtd->dai_link->ops->shutdown)
606-
rtd->dai_link->ops->shutdown(substream);
613+
soc_rtd_shutdown(rtd, substream);
607614

608615
machine_err:
609616
i = rtd->num_codecs;
@@ -674,8 +681,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
674681
for_each_rtd_codec_dai(rtd, i, codec_dai)
675682
snd_soc_dai_shutdown(codec_dai, substream);
676683

677-
if (rtd->dai_link->ops->shutdown)
678-
rtd->dai_link->ops->shutdown(substream);
684+
soc_rtd_shutdown(rtd, substream);
679685

680686
soc_pcm_components_close(substream, NULL);
681687

0 commit comments

Comments
 (0)