diff mbox

ASoC: soc-core: initialize debugfs in snd_soc_instantiate_card()

Message ID 87mw323h3p.wl%kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kuninori Morimoto March 24, 2015, 9:01 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current soc_init_card_debugfs() is called from snd_soc_register_card()
but, soc_cleanup_card_debugfs() is called from soc_cleanup_card_resources(),
not from paired function.

This differences don't matter for now. But if anyone wants to implement
a proper hotplug/unplug, this difference would become clearer.

Now, we can assume that snd_soc_instantiate_card() and
soc_cleanup_card_resources() are paired function.
soc_init_card_debugfs() / soc_cleanup_card_debugfs() paired function
should be called from these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Mark Brown March 24, 2015, 5:48 p.m. UTC | #1
On Tue, Mar 24, 2015 at 09:01:00AM +0000, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Current soc_init_card_debugfs() is called from snd_soc_register_card()
> but, soc_cleanup_card_debugfs() is called from soc_cleanup_card_resources(),
> not from paired function.

Applied, thanks.
Mark Brown March 24, 2015, 5:48 p.m. UTC | #2
On Tue, Mar 24, 2015 at 09:01:00AM +0000, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Current soc_init_card_debugfs() is called from snd_soc_register_card()
> but, soc_cleanup_card_debugfs() is called from soc_cleanup_card_resources(),
> not from paired function.

Oh, and as I'm fairly sure I've said before please don't send new
patches in reply to existing threads - it makes things harder to follow.
diff mbox

Patch

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4c26074..76bfff2 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1690,6 +1690,8 @@  static int snd_soc_instantiate_card(struct snd_soc_card *card)
 	mutex_unlock(&card->mutex);
 	mutex_unlock(&client_mutex);
 
+	soc_init_card_debugfs(card);
+
 	return 0;
 
 probe_aux_dev_err:
@@ -2381,8 +2383,6 @@  int snd_soc_register_card(struct snd_soc_card *card)
 
 	snd_soc_initialize_card_lists(card);
 
-	soc_init_card_debugfs(card);
-
 	card->rtd = devm_kzalloc(card->dev,
 				 sizeof(struct snd_soc_pcm_runtime) *
 				 (card->num_links + card->num_aux_devs),
@@ -2413,7 +2413,7 @@  int snd_soc_register_card(struct snd_soc_card *card)
 
 	ret = snd_soc_instantiate_card(card);
 	if (ret != 0)
-		soc_cleanup_card_debugfs(card);
+		return ret;
 
 	/* deactivate pins to sleep state */
 	for (i = 0; i < card->num_rtd; i++) {