summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2020-01-22 03:44:48 +0300
committerMark Brown <broonie@kernel.org>2020-01-23 15:19:54 +0300
commitde9ad990284f16a435675e4e73c7ffaaea9ee4b2 (patch)
tree7002e7ff764427b74c2e451aba713b230f25221d /sound
parent44c1a75b0d889b3a5faff9edc837d972806bb46a (diff)
downloadlinux-de9ad990284f16a435675e4e73c7ffaaea9ee4b2.tar.xz
ASoC: soc-pcm: add soc_rtd_hw_params()
Add soc_rtd_hw_params() to make the code easier to read Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/874kwomi9r.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>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-pcm.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index ccd6c9ca55ab..d7fc6c5d7906 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -54,6 +54,16 @@ static int soc_rtd_prepare(struct snd_soc_pcm_runtime *rtd,
return 0;
}
+static int soc_rtd_hw_params(struct snd_soc_pcm_runtime *rtd,
+ struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params)
+{
+ if (rtd->dai_link->ops &&
+ rtd->dai_link->ops->hw_params)
+ return rtd->dai_link->ops->hw_params(substream, params);
+ return 0;
+}
+
/**
* snd_soc_runtime_activate() - Increment active count for PCM runtime components
* @rtd: ASoC PCM runtime that is activated
@@ -826,13 +836,11 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if (ret)
goto out;
- if (rtd->dai_link->ops->hw_params) {
- ret = rtd->dai_link->ops->hw_params(substream, params);
- if (ret < 0) {
- dev_err(rtd->card->dev, "ASoC: machine hw_params"
- " failed: %d\n", ret);
- goto out;
- }
+ ret = soc_rtd_hw_params(rtd, substream, params);
+ if (ret < 0) {
+ dev_err(rtd->card->dev,
+ "ASoC: machine hw_params failed: %d\n", ret);
+ goto out;
}
for_each_rtd_codec_dai(rtd, i, codec_dai) {