From 2471b6c80a70e80de69f5ff4c37187c3912e5874 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 18 May 2015 09:20:24 +0200 Subject: ALSA: info: Register proc entries recursively, too The commit [c560a6797e3b: ALSA: core: Remove child proc file elements recursively] converted snd_card_proc_new() with the normal snd_info_*() call and removed snd_device chain for such info entries. However, it misses one point: the creation of the proc entry was managed by snd_device chain in the former code, and now it's also gone, which results in no proc files creation at all. Mea culpa. This patch makes snd_info_card_register() creating the all pending child proc entries in a shot. Also, since snd_card_register() might be called multiple times, this function is also changed to be callable multiple times. Along with the changes above, now the linked list of snd_info_entry is added at creation time instead of snd_info_register() for keeping eyes of pending info entries. Fixes: c560a6797e3b ('ALSA: core: Remove child proc file elements recursively') Reported-by: "Lu, Han" Signed-off-by: Takashi Iwai --- sound/core/init.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'sound/core/init.c') diff --git a/sound/core/init.c b/sound/core/init.c index 769a783757ff..f8abd2d8144e 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -107,26 +107,20 @@ static void snd_card_id_read(struct snd_info_entry *entry, snd_iprintf(buffer, "%s\n", entry->card->id); } -static inline int init_info_for_card(struct snd_card *card) +static int init_info_for_card(struct snd_card *card) { int err; struct snd_info_entry *entry; - if ((err = snd_info_card_register(card)) < 0) { - dev_dbg(card->dev, "unable to create card info\n"); - return err; - } - if ((entry = snd_info_create_card_entry(card, "id", card->proc_root)) == NULL) { + entry = snd_info_create_card_entry(card, "id", card->proc_root); + if (!entry) { dev_dbg(card->dev, "unable to create card entry\n"); return err; } entry->c.text.read = snd_card_id_read; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } card->proc_id = entry; - return 0; + + return snd_info_card_register(card); } #else /* !CONFIG_PROC_FS */ #define init_info_for_card(card) @@ -756,7 +750,7 @@ int snd_card_register(struct snd_card *card) if (snd_cards[card->number]) { /* already registered */ mutex_unlock(&snd_card_mutex); - return 0; + return snd_info_card_register(card); /* register pending info */ } if (*card->id) { /* make a unique id name from the given string */ -- cgit v1.2.3