aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKuninori Morimoto <[email protected]>2020-01-22 09:44:52 +0900
committerMark Brown <[email protected]>2020-01-23 12:19:58 +0000
commit49f020e5714d2c48c8ed9a89169ef6a058e54c2f (patch)
tree9a939e6274cc799c1fce7c04e73648a251e70414
parentde9ad990284f16a435675e4e73c7ffaaea9ee4b2 (diff)
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]>
-rw-r--r--sound/soc/soc-pcm.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index d7fc6c5d7906..718749f12979 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -64,6 +64,14 @@ static int soc_rtd_hw_params(struct snd_soc_pcm_runtime *rtd,
return 0;
}
+static void soc_rtd_hw_free(struct snd_soc_pcm_runtime *rtd,
+ struct snd_pcm_substream *substream)
+{
+ if (rtd->dai_link->ops &&
+ rtd->dai_link->ops->hw_free)
+ rtd->dai_link->ops->hw_free(substream);
+}
+
/**
* snd_soc_runtime_activate() - Increment active count for PCM runtime components
* @rtd: ASoC PCM runtime that is activated
@@ -935,8 +943,7 @@ codec_err:
codec_dai->rate = 0;
}
- if (rtd->dai_link->ops->hw_free)
- rtd->dai_link->ops->hw_free(substream);
+ soc_rtd_hw_free(rtd, substream);
mutex_unlock(&rtd->card->pcm_mutex);
return ret;
@@ -979,8 +986,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
}
/* free any machine hw params */
- if (rtd->dai_link->ops->hw_free)
- rtd->dai_link->ops->hw_free(substream);
+ soc_rtd_hw_free(rtd, substream);
/* free any component resources */
soc_pcm_components_hw_free(substream, NULL);