[PATCH] ASoC: soc-pcm: Revert "call snd_soc_component_open/close() once"

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Mon Mar 2 01:29:30 CET 2020


Hi Kai

Thank you for your feedback

> int snd_soc_component_open(struct snd_soc_component *component,
> »       »       »          struct snd_pcm_substream *substream)
(snip)
> int snd_soc_component_prepare(struct snd_soc_component *component,
> »       »       »             struct snd_pcm_substream *substream)
> {
> »       if (component->driver->prepare)
> »       »       return component->driver->prepare(component, substream);
> »       return 0;
> }

I guess you are thinking more big scale tracking/solution (?).
Indeed it is needed, but my indicated one is not for it.
It is just for "we want to use soc_pcm_close() as soc_pcm_open() error handling".

> > 	int soc_pcm_open(...)
> > 	{
> > 		static u8 id;
> > 
> > 		/* update ID */
> > 		id++;
> > 		if (id == 0)
> > 			id++;
> 
> ... this really isn't solid. If you have a complex scenario and something 
> goes wrong, debugging the ids is going to be painful if they are assigned 
> this way.

Maybe the naming of "ID" makes you confused ?
It is just "mark" for this "soc_pcm_open()".
If error happen during open, "error handling soc_pcm_close()" cares only this mark.
It is just for avoiding mismatch close.

Your big scale tracking (open/prepare/...) is maybe next step / more advanced problem.
My got feeling is that it is similar to SND_SOC_DPCM_STATE_xxx ?

Thank you for your help !!
Best regards
---
Kuninori Morimoto


More information about the Alsa-devel mailing list