[PATCH 15/25] ASoC: soc-component: add snd_soc_component_pcm_free()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>

Current ALSA SoC is directly using component->driver->xxx,
thus, it is deep nested, and makes code difficult to read,
and is not good for encapsulation.
This patch adds new snd_soc_component_pcm_free() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
---
 include/sound/soc-component.h | 2 ++
 sound/soc/soc-component.c     | 7 +++++++
 sound/soc/soc-pcm.c           | 3 +--
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 9e61a52..96ea44e 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -354,5 +354,7 @@ int snd_soc_component_mmap(struct snd_soc_component *component,
 			   struct vm_area_struct *vma);
 int snd_soc_component_pcm_new(struct snd_soc_component *component,
 			      struct snd_soc_pcm_runtime *rtd);
+void snd_soc_component_pcm_free(struct snd_soc_component *component,
+				struct snd_pcm *pcm);
 
 #endif /* __SOC_COMPONENT_H */
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 8f3679e..4473f55 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -412,3 +412,10 @@ int snd_soc_component_pcm_new(struct snd_soc_component *component,
 
 	return 0;
 }
+
+void snd_soc_component_pcm_free(struct snd_soc_component *component,
+				struct snd_pcm *pcm)
+{
+	if (component->driver->pcm_free)
+		component->driver->pcm_free(pcm);
+}
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 466802f..53b8a95 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2830,8 +2830,7 @@ static void soc_pcm_private_free(struct snd_pcm *pcm)
 	for_each_rtdcom(rtd, rtdcom) {
 		component = rtdcom->component;
 
-		if (component->driver->pcm_free)
-			component->driver->pcm_free(pcm);
+		snd_soc_component_pcm_free(component, pcm);
 	}
 }
 
-- 
2.7.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux