Hi Mark, again
...this doesn't look like the right fix. If we just plain unregister the card then if the component that was removed is loaded again then the card won't be reinstantiated since the core has forgotten about the card. Further, if the card driver is removed then we'll get a duplicate attempt to unregister it which doesn't seem clever.
What we need to do here is undo all the work that was done to instantiate the card but not actually unregister it, returning everything to the state it was in before the card was instantiated. That's obviously a much more substantial change than this but it's what's needed (and is the main reason this is broken at the minute).
Hmm...
In normal ASoC card, it will re-try .probe if necessary cpu/codec was not probed (= -EPROBE_DEFER in soc_bind_dai_link()). This is the before state of card was instantiated. Returning everything to the before state = unregister card is very natural I think... If possible, we want to add this card driver to deferred_probe_pending_list in drivers/base/dd.c, but it is over kill ?
Best regards --- Kuninori Morimoto