Skip to content

Commit f183f92

Browse files
morimotobroonie
authored andcommitted
ASoC: soc-pcm: add soc_rtd_startup()
Add soc_rtd_startup() 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 df31007 commit f183f92

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

sound/soc/soc-pcm.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@
2828

2929
#define DPCM_MAX_BE_USERS 8
3030

31+
static int soc_rtd_startup(struct snd_soc_pcm_runtime *rtd,
32+
struct snd_pcm_substream *substream)
33+
{
34+
if (rtd->dai_link->ops &&
35+
rtd->dai_link->ops->startup)
36+
return rtd->dai_link->ops->startup(substream);
37+
return 0;
38+
}
39+
3140
/**
3241
* snd_soc_runtime_activate() - Increment active count for PCM runtime components
3342
* @rtd: ASoC PCM runtime that is activated
@@ -522,13 +531,11 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
522531
codec_dai->rx_mask = 0;
523532
}
524533

525-
if (rtd->dai_link->ops->startup) {
526-
ret = rtd->dai_link->ops->startup(substream);
527-
if (ret < 0) {
528-
pr_err("ASoC: %s startup failed: %d\n",
529-
rtd->dai_link->name, ret);
530-
goto machine_err;
531-
}
534+
ret = soc_rtd_startup(rtd, substream);
535+
if (ret < 0) {
536+
pr_err("ASoC: %s startup failed: %d\n",
537+
rtd->dai_link->name, ret);
538+
goto machine_err;
532539
}
533540

534541
/* Dynamic PCM DAI links compat checks use dynamic capabilities */

0 commit comments

Comments
 (0)