On Sat, Jul 30, 2016 at 06:45:04AM +0900, Takashi Sakamoto wrote:
In a point of 'reuse of codes', I cannot imagine what Lars said for USB devices, then post the questions.
Someone might make a fancy device connected via USB which doesn't conform to the USB specs.
But I think it's logically difficult to manage state of sound card; e.g. disconnect. When one sound card instance consists of instances of several 'DAI', 'Codecs' and 'Components' (this 'component' is not in ALSA core contexts[1]) and we try to unload one of them, then which state the card should be assigned to? Or no 'Codecs' drivers are loaded, then which state should be assigned to the card?
The card only instantiates when all the components of the card are present, until then it defers probe.
Additionally, when old Codec driver is unloaded and new Codec driver is loaded, then what should we do for corresponding PCM character devices are? Currently, once snd_card_regsiter() is called, we cannot insert/delete ALSA components such like PCM.
The card should be deinstantiated and reinstantiated whenever a component driver unbinds and rebinds (respectively). You'd need to completely deregister the card to change the list of things it's expecting currently.