summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2020-11-13 13:15:26 +0900
committerMark Brown <broonie@kernel.org>2020-11-18 18:00:08 +0000
commitdbde5e21140cd2ad9d9e8eeeb104755f5294ce9f (patch)
tree18601b8779cb67a8e5eba5efe092024587c2614c /sound/soc
parenta4e427c59a266dc3eb0eb5d52879b067a6f6e73b (diff)
ASoC: soc-component: add snd_soc_component_compr_free()
component related function should be implemented at soc-component.c. This patch moves soc-compress soc_compr_components_free() to soc-component as snd_soc_component_compr_free(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/87eekx7v7r.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/soc-component.c18
-rw-r--r--sound/soc/soc-compress.c29
2 files changed, 22 insertions, 25 deletions
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index a711bee11712..5dcbdfe411f6 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -444,6 +444,24 @@ int snd_soc_component_compr_open(struct snd_compr_stream *cstream,
}
EXPORT_SYMBOL_GPL(snd_soc_component_compr_open);
+void snd_soc_component_compr_free(struct snd_compr_stream *cstream,
+ struct snd_soc_component *last)
+{
+ struct snd_soc_pcm_runtime *rtd = cstream->private_data;
+ struct snd_soc_component *component;
+ int i;
+
+ for_each_rtd_components(rtd, i, component) {
+ if (component == last)
+ break;
+
+ if (component->driver->compress_ops &&
+ component->driver->compress_ops->free)
+ component->driver->compress_ops->free(component, cstream);
+ }
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_compr_free);
+
static unsigned int soc_component_read_no_lock(
struct snd_soc_component *component,
unsigned int reg)
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index d55ea0db7901..4517baf0e62c 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -22,27 +22,6 @@
#include <sound/soc-link.h>
#include <linux/pm_runtime.h>
-static int soc_compr_components_free(struct snd_compr_stream *cstream,
- struct snd_soc_component *last)
-{
- struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_component *component;
- int i;
-
- for_each_rtd_components(rtd, i, component) {
- if (component == last)
- break;
-
- if (!component->driver->compress_ops ||
- !component->driver->compress_ops->free)
- continue;
-
- component->driver->compress_ops->free(component, cstream);
- }
-
- return 0;
-}
-
static int soc_compr_open(struct snd_compr_stream *cstream)
{
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
@@ -76,7 +55,7 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
return 0;
machine_err:
- soc_compr_components_free(cstream, component);
+ snd_soc_component_compr_free(cstream, component);
snd_soc_dai_compr_shutdown(cpu_dai, cstream);
out:
@@ -150,7 +129,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
return 0;
machine_err:
- soc_compr_components_free(cstream, component);
+ snd_soc_component_compr_free(cstream, component);
open_err:
snd_soc_dai_compr_shutdown(cpu_dai, cstream);
out:
@@ -182,7 +161,7 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
snd_soc_link_compr_shutdown(cstream);
- soc_compr_components_free(cstream, NULL);
+ snd_soc_component_compr_free(cstream, NULL);
snd_soc_dai_compr_shutdown(cpu_dai, cstream);
@@ -230,7 +209,7 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
snd_soc_link_compr_shutdown(cstream);
- soc_compr_components_free(cstream, NULL);
+ snd_soc_component_compr_free(cstream, NULL);
snd_soc_dai_compr_shutdown(cpu_dai, cstream);