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

Kai Vehmanen kai.vehmanen at linux.intel.com
Thu Feb 20 10:33:03 CET 2020


Hi,

On Thu, 20 Feb 2020, Kuninori Morimoto wrote:

> > ASoC component open/close and snd_soc_component_module_get/put are
> > called independently for each component-substream pair, so the logic
> > in the reverted patch was not sufficient and led to PCM playback and
> > module unload errors.
> 
> But, unfortunately I don't want spaghetti error handling code again.
> I think we can solve it if we can *count* open / module ?
> Can you please test this patch ?

I tested and this version works as well, so:
Reviewed-by: Kai Vehmanen <kai.vehmanen at linux.intel.com>

... but, but, I have some doubts about th "opened" tracking as a solution.

A single counter will track the overall number of component-substream 
combinations, but if we have bugs in calling code and e.g. same 
component-substream is passed multiple times to open or close, the 
the single counter will go out of sync.

So if the primary problem is the messy rollback in case one open fails, 
what if we do the rollback directly in soc_pcm_components_open() and do
not add any additional tracking..?

Let me send a proposal patch for that.

Br, Kai


More information about the Alsa-devel mailing list