diff mbox series

[10/24] ASoC: soc-component: add snd_soc_component_compr_free()

Message ID 87v9kby3bv.wl-kuninori.morimoto.gx@renesas.com
State Accepted
Commit dbde5e21140cd2ad9d9e8eeeb104755f5294ce9f
Headers show
Series ASoC: soc-component: collect component functions | expand

Commit Message

Kuninori Morimoto June 1, 2020, 1:36 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>
---
 include/sound/soc-component.h |  2 ++
 sound/soc/soc-component.c     | 18 ++++++++++++++++++
 sound/soc/soc-compress.c      | 29 ++++-------------------------
 3 files changed, 24 insertions(+), 25 deletions(-)
diff mbox series

Patch

diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 4f82839948d6..090ea500d11d 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -438,6 +438,8 @@  int snd_soc_component_of_xlate_dai_name(struct snd_soc_component *component,
 					const char **dai_name);
 int snd_soc_component_compr_open(struct snd_compr_stream *cstream,
 				 struct snd_soc_component **last);
+void snd_soc_component_compr_free(struct snd_compr_stream *cstream,
+				  struct snd_soc_component *last);
 
 int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream);
 int snd_soc_pcm_component_ioctl(struct snd_pcm_substream *substream,
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index c2a6046a6380..375319142305 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -407,6 +407,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);
+
 int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 2a0d554013a4..c164b93c8a0e 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;
@@ -80,7 +59,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:
@@ -164,7 +143,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:
@@ -202,7 +181,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);
 
@@ -257,7 +236,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);