[PATCH] ASoC: soc-pcm: Revert "call snd_soc_component_open/close() once"
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Tue Mar 3 01:43:53 CET 2020
Hi Kai
Thank you for your feedback
> /* add list of opened substreams to snd_soc_component */
> struct snd_soc_component {
> ...
> struct list_head substream_list;
>
> int snd_soc_component_open(struct snd_soc_component *component,
> » » » struct snd_pcm_substream *substream)
> {
> int res = 0;
> if (component->driver->open)
> res = component->driver->open(component, substream);
>
> /* on success, add proxy of substream to component->substream_list */
> ...
>
> int snd_soc_component_close(struct snd_soc_component *component,
> » » » struct snd_pcm_substream *substream)
> {
> /*
> * lookup substream from "component->substream_List",
> * only call driver->close() if found
> */
> ...
>
>
> ... this is arguably more code, but makes the state created in
> snd_soc_component_open() explicit. Upon error in middle of
> components_open(), one can just call soc_pcm_components_close() which will
> close all components for that substream (that had been succesfully
> opened).
k
Yes, totally agree to your code.
But, 1 point I still not yet understand.
close() will be called 1) when open failed, or, 2) normal close.
If my understanding was correct, your code is caring that
2) normal close() might be called without open().
I don't think it happen, but are you worrying that it might be
happen by some BUG, or for some accident ?
If so, I can 100% understand your idea.
Thank you for your help !!
Best regards
---
Kuninori Morimoto
More information about the Alsa-devel
mailing list