All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>, Simon <horms@verge.net.au>
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	[thread overview]
Message-ID: <s5hpp7ykd22.wl-tiwai@suse.de> (raw)
In-Reply-To: <87sicu3j4o.wl%kuninori.morimoto.gx@renesas.com>

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

  reply	other threads:[~2015-03-24  8:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24  1:44 [PATCH] ASoC: soc-core: call soc_cleanup_card_debugfs() from snd_soc_unregister_card() Kuninori Morimoto
2015-03-24  6:54 ` Takashi Iwai
2015-03-24  8:17   ` Kuninori Morimoto
2015-03-24  8:35     ` Takashi Iwai [this message]
2015-03-24  9:00       ` Kuninori Morimoto
2015-03-24  9:01         ` [PATCH] ASoC: soc-core: initialize debugfs in snd_soc_instantiate_card() Kuninori Morimoto
2015-03-24 17:48           ` Mark Brown
2015-03-24 17:48           ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hpp7ykd22.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=horms@verge.net.au \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.