Skip to content

Commit 49f020e

Browse files
morimotobroonie
authored andcommitted
ASoC: soc-pcm: add soc_rtd_hw_free()
Add soc_rtd_hw_free() 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 de9ad99 commit 49f020e

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
@@ -64,6 +64,14 @@ static int soc_rtd_hw_params(struct snd_soc_pcm_runtime *rtd,
6464
return 0;
6565
}
6666

67+
static void soc_rtd_hw_free(struct snd_soc_pcm_runtime *rtd,
68+
struct snd_pcm_substream *substream)
69+
{
70+
if (rtd->dai_link->ops &&
71+
rtd->dai_link->ops->hw_free)
72+
rtd->dai_link->ops->hw_free(substream);
73+
}
74+
6775
/**
6876
* snd_soc_runtime_activate() - Increment active count for PCM runtime components
6977
* @rtd: ASoC PCM runtime that is activated
@@ -935,8 +943,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
935943
codec_dai->rate = 0;
936944
}
937945

938-
if (rtd->dai_link->ops->hw_free)
939-
rtd->dai_link->ops->hw_free(substream);
946+
soc_rtd_hw_free(rtd, substream);
940947

941948
mutex_unlock(&rtd->card->pcm_mutex);
942949
return ret;
@@ -979,8 +986,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
979986
}
980987

981988
/* free any machine hw params */
982-
if (rtd->dai_link->ops->hw_free)
983-
rtd->dai_link->ops->hw_free(substream);
989+
soc_rtd_hw_free(rtd, substream);
984990

985991
/* free any component resources */
986992
soc_pcm_components_hw_free(substream, NULL);

0 commit comments

Comments
 (0)