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

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

 



Hey,

catching up with the thread :)

On Fri, 28 Feb 2020, Kuninori Morimoto wrote:

> > > 	start(substream-A); <=
> > > 	start(substream-B);
> > > 	start(substream-C);
> > >
> > > 	stop(substream-Z);  <=
> > > 	stop(substream-B);
> > > 	stop(substream-C);
[snip]
> I don't want to have substream list on each components,
> and keep simple code as much as possible.
[snip]
> My current idea is using ID. What do you think ?
> It is not super simple though...

Hmm, I think then we end up with new problems managing the IDs.
Specifically:

> 	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.

I think in the end we should go back to this:

int snd_soc_component_open(struct snd_soc_component *component,
»       »       »          struct snd_pcm_substream *substream)

... this essentially creates new state by assigning a new substream to the 
component, and we should explicitly track it. I know you wanted to avoid 
this, but I think in the end it's the cleanest solution and aligned to 
rest of ALSA. Aside cleaning up implementation of close(), this will help 
also in other methods, like e.g.:

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;
}

.. if prepare() is called with a substream that is not opened for this 
component, we could catch it here if we were tracking substreams.

Br, Kai



[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