From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
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@renesas.com --- 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); } }