At Tue, 24 Mar 2015 01:44:49 +0000, Kuninori Morimoto wrote:
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Card debugfs is created in snd_soc_register_card(), but soc_cleanup_card_debugfs() is called from soc_cleanup_card_resources(). Cleanup function should be called from paired unregister function.
Why only soc_cleanup_card_debugfs() needs to be handled specially? Other stuff in soc_cleanup_card_resources() are also initialized in soc_register_card().
If the reason is different (e.g. for further fix of hot unplug bug), it'd be understandable, though. In general, the ALSA device free consists of three phases: 1. device disconnection 2. wait until all devices are closed 3. actual free all resources
And soc_cleanup_card_debugfs() basically belongs to 1, not 3.
The above differences don't matter for now because currently ASoC calls snd_card_free() and this function does all these by itself. But if anyone wants to implement a proper hotplug/unplug, this difference would become clearer; i.e. you need to split the stuff in soc_cleanup_card_resources() into two, one for 1 and another for 3.
BTW, the call of soc_cleanup_card_debugfs() was forgotten in a few error paths of snd_soc_register_card(). Any taker?
thanks,
Takashi
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
sound/soc/soc-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 4c26074..211783f 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1751,8 +1751,6 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card) /* remove and free each DAI */ soc_remove_dai_links(card);
- soc_cleanup_card_debugfs(card);
- /* remove the card */ if (card->remove) card->remove(card);
@@ -2447,6 +2445,7 @@ int snd_soc_unregister_card(struct snd_soc_card *card) card->instantiated = false; snd_soc_dapm_shutdown(card); soc_cleanup_card_resources(card);
dev_dbg(card->dev, "ASoC: Unregistered card '%s'\n", card->name); }soc_cleanup_card_debugfs(card);
-- 1.9.1
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel