[alsa-devel] [PATCH v3 06/19] ASoC: soc-core: add soc_unbind_dai_link()

Takashi Iwai tiwai at suse.de
Wed Nov 13 06:57:24 CET 2019


On Wed, 13 Nov 2019 05:37:46 +0100,
Kuninori Morimoto wrote:
> 
> @@ -1965,12 +1968,6 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card)
>  {
>  	struct snd_soc_dai_link *link, *_link;
>  
> -	/* free the ALSA card at first; this syncs with pending operations */
> -	if (card->snd_card) {
> -		snd_card_free(card->snd_card);
> -		card->snd_card = NULL;
> -	}
> -
>  	/* remove and free each DAI */
>  	soc_remove_link_dais(card);
>  	soc_remove_link_components(card);
> @@ -1988,6 +1985,11 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card)
>  	/* remove the card */
>  	if (card->remove)
>  		card->remove(card);
> +
> +	if (card->snd_card) {
> +		snd_card_free(card->snd_card);
> +		card->snd_card = NULL;
> +	}

This will likely break unbind again; when unbind is performed in a
busy state, the code may release still-in-use resources.  The rcar
driver seems to have its own disconnect_sync() call so it'd work even
with this change, but others wouldn't.

At least you need to call snd_card_disconnect_sync() at the first
place, then release the rest at the second place.


thanks,

Takashi


More information about the Alsa-devel mailing list