summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-pcm.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2020-02-10 12:14:37 +0900
committerMark Brown <broonie@kernel.org>2020-02-12 23:51:36 +0000
commitdd03907bf129b42e9e3203fdf405ea9873b28dd3 (patch)
treeac89a5bd09b65a3f91c4abdce6ba181e8c5f8993 /sound/soc/soc-pcm.c
parent514de1c935d1670e0f162210f3794cf0be67c8a7 (diff)
downloadlinux-dd03907bf129b42e9e3203fdf405ea9873b28dd3.tar.bz2
ASoC: soc-pcm: call snd_soc_component_open/close() once
Current soc_pcm_open() calls snd_soc_component_open() under loop. Thus, it needs to care about opened/not-yet-opened Component. But, if soc-component.c is handling it, soc-pcm.c don't need to care about it. This patch adds opened flag to soc-component.h, and simplify soc-pcm.c. This is one of prepare for cleanup soc-pcm-open() Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/874kvzcey1.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-pcm.c')
-rw-r--r--sound/soc/soc-pcm.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index d53afb96b05b..ae94d8a86992 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -463,16 +463,13 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_substream *substream)
hw->rate_max = min_not_zero(hw->rate_max, rate_max);
}
-static int soc_pcm_components_open(struct snd_pcm_substream *substream,
- struct snd_soc_component **last)
+static int soc_pcm_components_open(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component;
int i, ret = 0;
for_each_rtd_components(rtd, i, component) {
- *last = component;
-
ret = snd_soc_component_module_get_when_open(component);
if (ret < 0) {
dev_err(component->dev,
@@ -489,21 +486,17 @@ static int soc_pcm_components_open(struct snd_pcm_substream *substream,
return ret;
}
}
- *last = NULL;
+
return 0;
}
-static int soc_pcm_components_close(struct snd_pcm_substream *substream,
- struct snd_soc_component *last)
+static int soc_pcm_components_close(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component;
int i, r, ret = 0;
for_each_rtd_components(rtd, i, component) {
- if (component == last)
- break;
-
r = snd_soc_component_close(component, substream);
if (r < 0)
ret = r; /* use last ret */
@@ -545,7 +538,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
goto out;
}
- ret = soc_pcm_components_open(substream, &component);
+ ret = soc_pcm_components_open(substream);
if (ret < 0)
goto component_err;
@@ -642,7 +635,7 @@ codec_dai_err:
snd_soc_dai_shutdown(codec_dai, substream);
component_err:
- soc_pcm_components_close(substream, component);
+ soc_pcm_components_close(substream);
snd_soc_dai_shutdown(cpu_dai, substream);
out:
@@ -696,7 +689,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
soc_rtd_shutdown(rtd, substream);
- soc_pcm_components_close(substream, NULL);
+ soc_pcm_components_close(substream);
snd_soc_dapm_stream_stop(rtd, substream->stream);