diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-04-22 22:14:41 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-04-24 17:31:02 +0200 |
commit | 644dbd64dcf0939e9838132a72d2ec9489496eb8 (patch) | |
tree | 36fda99c8bf230f952bb0f23658b5f3ff90f8905 /sound/core | |
parent | c560a6797e3bec1e04f1f6f9f3c2135db0f5c8ee (diff) |
ALSA: core: Manage asound root directory with snd_info_entry
Using snd_info_entry for /proc/asound root makes easier to release the
all children, too. Further cleanups will follow.
Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/info.c | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/sound/core/info.c b/sound/core/info.c index 96451a130199..55c626eeb061 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -78,14 +78,13 @@ struct snd_info_private_data { }; static int snd_info_version_init(void); -static int snd_info_version_done(void); static void snd_info_disconnect(struct snd_info_entry *entry); /* */ -static struct proc_dir_entry *snd_proc_root; +static struct snd_info_entry *snd_proc_root; struct snd_info_entry *snd_seq_root; EXPORT_SYMBOL(snd_seq_root); @@ -462,14 +461,17 @@ static struct snd_info_entry *create_subdir(struct module *mod, return entry; } +static struct snd_info_entry *snd_info_create_entry(const char *name); + int __init snd_info_init(void) { - struct proc_dir_entry *p; - - p = proc_mkdir("asound", NULL); - if (p == NULL) + snd_proc_root = snd_info_create_entry("asound"); + if (!snd_proc_root) return -ENOMEM; - snd_proc_root = p; + snd_proc_root->mode = S_IFDIR | S_IRUGO | S_IXUGO; + snd_proc_root->p = proc_mkdir("asound", NULL); + if (!snd_proc_root->p) + goto error; #ifdef CONFIG_SND_OSSEMUL snd_oss_root = create_subdir(THIS_MODULE, "oss"); if (!snd_oss_root) @@ -487,10 +489,7 @@ int __init snd_info_init(void) return 0; error: -#ifdef CONFIG_SND_OSSEMUL - snd_info_free_entry(snd_oss_root); -#endif - proc_remove(snd_proc_root); + snd_info_free_entry(snd_proc_root); return -ENOMEM; } @@ -499,25 +498,11 @@ int __exit snd_info_done(void) snd_card_info_done(); snd_minor_info_oss_done(); snd_minor_info_done(); - snd_info_version_done(); - if (snd_proc_root) { -#if IS_ENABLED(CONFIG_SND_SEQUENCER) - snd_info_free_entry(snd_seq_root); -#endif -#ifdef CONFIG_SND_OSSEMUL - snd_info_free_entry(snd_oss_root); -#endif - proc_remove(snd_proc_root); - } + snd_info_free_entry(snd_proc_root); return 0; } /* - - */ - - -/* * create a card proc file * called from init.c */ @@ -551,7 +536,7 @@ int snd_info_card_register(struct snd_card *card) if (!strcmp(card->id, card->proc_root->name)) return 0; - p = proc_symlink(card->id, snd_proc_root, card->proc_root->name); + p = proc_symlink(card->id, snd_proc_root->p, card->proc_root->name); if (p == NULL) return -ENOMEM; card->proc_root_link = p; @@ -570,7 +555,7 @@ void snd_info_card_id_change(struct snd_card *card) } if (strcmp(card->id, card->proc_root->name)) card->proc_root_link = proc_symlink(card->id, - snd_proc_root, + snd_proc_root->p, card->proc_root->name); mutex_unlock(&info_mutex); } @@ -815,7 +800,7 @@ int snd_info_register(struct snd_info_entry * entry) if (snd_BUG_ON(!entry)) return -ENXIO; - root = entry->parent == NULL ? snd_proc_root : entry->parent->p; + root = entry->parent == NULL ? snd_proc_root->p : entry->parent->p; mutex_lock(&info_mutex); if (S_ISDIR(entry->mode)) { p = proc_mkdir_mode(entry->name, entry->mode, root); @@ -850,8 +835,6 @@ EXPORT_SYMBOL(snd_info_register); */ -static struct snd_info_entry *snd_info_version_entry; - static void snd_info_version_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { snd_iprintf(buffer, @@ -871,13 +854,6 @@ static int __init snd_info_version_init(void) snd_info_free_entry(entry); return -ENOMEM; } - snd_info_version_entry = entry; - return 0; -} - -static int __exit snd_info_version_done(void) -{ - snd_info_free_entry(snd_info_version_entry); return 0; } |