[PATCH] ASoC: soc-pcm: Revert "call snd_soc_component_open/close() once"
Kai Vehmanen
kai.vehmanen at linux.intel.com
Tue Mar 3 20:48:31 CET 2020
Hey,
On Tue, 3 Mar 2020, Kuninori Morimoto wrote:
> Kai Vehmanen wrote:
>> 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
>
> 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().
it also covers case (1) when open fails. So instead of the currently
merged error case rollback code in soc_pcm_components_open(), we'd just
call snd_pcm_components_close(substream) directly in case
of error. With tracking of opened substreams in soc-component.c, close()
is safe to call also in error case.
But you are right, I don't really see how (2) could be hit, so we are
essentially talking about how to avoid the <10 lines of rollback code in
soc_pcm_components_open(). :)
That considered, I'm fine if you can come up with a cleaner version to
handle just case (1), without tracking substreams. Maybe worth a try and
if it doesn't work (e.g. with ID/tag), we can look at substream tracking.
Br, Kai
More information about the Alsa-devel
mailing list