From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] ASoC: soc-core: call soc_cleanup_card_debugfs() from snd_soc_unregister_card() Date: Tue, 24 Mar 2015 09:35:49 +0100 Message-ID: References: <87a8z341ao.wl%kuninori.morimoto.gx@renesas.com> <87sicu3j4o.wl%kuninori.morimoto.gx@renesas.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 9A06226059C for ; Tue, 24 Mar 2015 09:35:50 +0100 (CET) In-Reply-To: <87sicu3j4o.wl%kuninori.morimoto.gx@renesas.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Kuninori Morimoto Cc: Linux-ALSA , Mark Brown , Liam Girdwood , Simon List-Id: alsa-devel@alsa-project.org At Tue, 24 Mar 2015 08:17:13 +0000, Kuninori Morimoto wrote: > > Hi Takashi > > Thank you for your feedback > > > 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. > > Hmm... I'm not 100% understand detail of ASoC functions, > but if so, debugfs should be created when "device connect", but > current code is creating it in "device register". Note that there is no "device connect" phase in ALSA. It's called before snd_card_register(), so it's an "init" phase. The "device connect" phase is invoked at snd_card_register(). > Can I assume that snd_soc_instantiate_card() <-> soc_cleanup_card_resources() are > paired function ? I'm not sure... > Anyway, it is easy to understand for me if > paired functions are called from paired parent functions if possible. > Currently debugfs is like this. > > snd_soc_register_card() <-> snd_soc_unregister_card() > - soc_init_card_debugfs() ???? > - snd_soc_instantiate_card() <-> - soc_cleanup_card_resources() > - soc_bind_dai_link() - soc_remove_dai_links() > - soc_probe_aux_dev() - soc_remove_aux_dev() > - card->probe() - card->remove() > - ???? - soc_cleanup_card_debugfs() IMO, a better change would be to call soc_init_card_debugfs() in snd_soc_instantiate_card(), supposing that the debugfs is available only for instantiated objects. This will fix the messy leakage at error paths, too. Takashi