[alsa-devel] [PATCH] soc-core: let suspend/resume not called if the card is not instantiated

Mark Brown broonie at opensource.wolfsonmicro.com
Fri Nov 13 18:04:59 CET 2009

On Fri, Nov 13, 2009 at 11:29:39PM +0800, Barry Song wrote:

> The logic seems different: in snd_soc_instantiate_card(), only while
> all cpu DAIs and codec DAIs are found and registered in the system
> except ac97, their probes will be called. Then card->instantiated
> becomes 1.
> A case current codes will cause crash is:
> For a CPU DAI driver based on platform driver, if arch hasn't defined
> the platform device for cpu dai, then cpu dai is not registered and
> initialized in the probe() of its platform driver. Even though its
> instance is in card->dai_link, it doesn't really enter the system. But
> while suspend/resume, its entries will be called too since the call
> doesn't check the existence:

Yes, that can go wrong - but as I say the converse thing can also go
wrong where some but not all of the card has managed to register and the
bits that have managed to register expect to be suspended by the core.

> I think suspend/resume of a DAI can only be called while it really
> exists and can be found in the dai_list, at least.

Checking to see if the device is in the DAI relevant list would work

> So I add a overall condition for soc_suspend/resume just like
> 	if (!card->instantiated)
> 		return 0
> has be done in soc_remove(),  soc_poweroff().

...this is too broad.

More information about the Alsa-devel mailing list