summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-component.c19
-rw-r--r--sound/soc/soc-pcm.c7
2 files changed, 13 insertions, 13 deletions
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 728e93f35ffb..6d719c2db92e 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -779,8 +779,7 @@ int snd_soc_pcm_component_prepare(struct snd_pcm_substream *substream)
}
int snd_soc_pcm_component_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params,
- struct snd_soc_component **last)
+ struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_soc_component *component;
@@ -790,33 +789,35 @@ int snd_soc_pcm_component_hw_params(struct snd_pcm_substream *substream,
if (component->driver->hw_params) {
ret = component->driver->hw_params(component,
substream, params);
- if (ret < 0) {
- *last = component;
+ if (ret < 0)
return soc_component_ret(component, ret);
- }
}
+ /* mark substream if succeeded */
+ soc_component_mark_push(component, substream, hw_params);
}
- *last = NULL;
return 0;
}
void snd_soc_pcm_component_hw_free(struct snd_pcm_substream *substream,
- struct snd_soc_component *last)
+ int rollback)
{
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_soc_component *component;
int i, ret;
for_each_rtd_components(rtd, i, component) {
- if (component == last)
- break;
+ if (rollback && !soc_component_mark_match(component, substream, hw_params))
+ continue;
if (component->driver->hw_free) {
ret = component->driver->hw_free(component, substream);
if (ret < 0)
soc_component_ret(component, ret);
}
+
+ /* remove marked substream */
+ soc_component_mark_pop(component, substream, hw_params);
}
}
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 8c69288f1bf5..6eec0f498090 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -889,7 +889,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
snd_soc_link_hw_free(substream, 0);
/* free any component resources */
- snd_soc_pcm_component_hw_free(substream, NULL);
+ snd_soc_pcm_component_hw_free(substream, 0);
/* now free hw params for the DAIs */
for_each_rtd_dais(rtd, i, dai) {
@@ -912,7 +912,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
- struct snd_soc_component *component;
struct snd_soc_dai *cpu_dai;
struct snd_soc_dai *codec_dai;
int i, ret = 0;
@@ -995,7 +994,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
snd_soc_dapm_update_dai(substream, params, cpu_dai);
}
- ret = snd_soc_pcm_component_hw_params(substream, params, &component);
+ ret = snd_soc_pcm_component_hw_params(substream, params);
if (ret < 0)
goto component_err;
@@ -1004,7 +1003,7 @@ out:
return ret;
component_err:
- snd_soc_pcm_component_hw_free(substream, component);
+ snd_soc_pcm_component_hw_free(substream, 1);
i = rtd->num_cpus;