On 2020-02-18 20:05, Pierre-Louis Bossart wrote:
Ain't hda-pcm.c the best place for it as "hstream->substream = substream" happens there too? If the cleanup is to be done in _hw_free(), then I'd expect the same to happen to the original assignments. Doubt we want to do the later so.. _close() for the win?
In general the existing hstream->substream initialization looks kinda disconnected from the actual stream assignment code - _stream_get() - as if the duties of the state machine were shared.
I am having difficulties interpreting your answer, i.e. I don't know what the last sentence refers to.
It's just safer to tie substream assignment directly with _stream_get() so problems such as this don't stay hidden and arise later during the development process. _stream_assign() in /hda/ext/hdac_ext_stream/ & _stream_release in /hda/hdac_stream do exactly that.
Currently open() and close() are perfectly symmetrical, I don't really see why you'd want to change and add an imbalanced set of operations, unless you moved
hstream->substream = substream;
to the open() instead of hw_params().
Or alternatively add a hw_free() in hda-pcm.c to mirror what's done in hw_params.
Relocated to _hw_free(). Thanks.