mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-06 12:44:14 +08:00
ASoC: soc-pcm: add soc_rtd_prepare()
Add soc_rtd_prepare() to make the code easier to read Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/875zh4mi9v.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>
This commit is contained in:
parent
0be429f9fc
commit
44c1a75b0d
@ -45,6 +45,15 @@ static void soc_rtd_shutdown(struct snd_soc_pcm_runtime *rtd,
|
|||||||
rtd->dai_link->ops->shutdown(substream);
|
rtd->dai_link->ops->shutdown(substream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int soc_rtd_prepare(struct snd_soc_pcm_runtime *rtd,
|
||||||
|
struct snd_pcm_substream *substream)
|
||||||
|
{
|
||||||
|
if (rtd->dai_link->ops &&
|
||||||
|
rtd->dai_link->ops->prepare)
|
||||||
|
return rtd->dai_link->ops->prepare(substream);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* snd_soc_runtime_activate() - Increment active count for PCM runtime components
|
* snd_soc_runtime_activate() - Increment active count for PCM runtime components
|
||||||
* @rtd: ASoC PCM runtime that is activated
|
* @rtd: ASoC PCM runtime that is activated
|
||||||
@ -716,13 +725,11 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
|
|||||||
|
|
||||||
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
|
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
|
||||||
|
|
||||||
if (rtd->dai_link->ops->prepare) {
|
ret = soc_rtd_prepare(rtd, substream);
|
||||||
ret = rtd->dai_link->ops->prepare(substream);
|
if (ret < 0) {
|
||||||
if (ret < 0) {
|
dev_err(rtd->card->dev,
|
||||||
dev_err(rtd->card->dev, "ASoC: machine prepare error:"
|
"ASoC: machine prepare error: %d\n", ret);
|
||||||
" %d\n", ret);
|
goto out;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for_each_rtd_components(rtd, i, component) {
|
for_each_rtd_components(rtd, i, component) {
|
||||||
|
Loading…
Reference in New Issue
Block a user