summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-05-18 03:43:30 -0400
committerTakashi Iwai <tiwai@suse.de>2015-05-18 03:44:28 -0400
commit8e7ccb7ba3b67245e7be0cadbdd2aaf4a3ba1f40 (patch)
tree4423350a4b6621310a9746adffd657ae0c9e9f2d
parent2471b6c80a70e80de69f5ff4c37187c3912e5874 (diff)
ALSA: info: Move list addition to snd_info_create_entry()
Just a minor refactoring, no functional changes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/core/info.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/sound/core/info.c b/sound/core/info.c
index 13b174464cc8..76cdf1d21f17 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -455,11 +455,12 @@ static struct snd_info_entry *create_subdir(struct module *mod,
455 return entry; 455 return entry;
456} 456}
457 457
458static struct snd_info_entry *snd_info_create_entry(const char *name); 458static struct snd_info_entry *
459snd_info_create_entry(const char *name, struct snd_info_entry *parent);
459 460
460int __init snd_info_init(void) 461int __init snd_info_init(void)
461{ 462{
462 snd_proc_root = snd_info_create_entry("asound"); 463 snd_proc_root = snd_info_create_entry("asound", NULL);
463 if (!snd_proc_root) 464 if (!snd_proc_root)
464 return -ENOMEM; 465 return -ENOMEM;
465 snd_proc_root->mode = S_IFDIR | S_IRUGO | S_IXUGO; 466 snd_proc_root->mode = S_IFDIR | S_IRUGO | S_IXUGO;
@@ -688,6 +689,7 @@ EXPORT_SYMBOL(snd_info_get_str);
688/** 689/**
689 * snd_info_create_entry - create an info entry 690 * snd_info_create_entry - create an info entry
690 * @name: the proc file name 691 * @name: the proc file name
692 * @parent: the parent directory
691 * 693 *
692 * Creates an info entry with the given file name and initializes as 694 * Creates an info entry with the given file name and initializes as
693 * the default state. 695 * the default state.
@@ -697,7 +699,8 @@ EXPORT_SYMBOL(snd_info_get_str);
697 * 699 *
698 * Return: The pointer of the new instance, or %NULL on failure. 700 * Return: The pointer of the new instance, or %NULL on failure.
699 */ 701 */
700static struct snd_info_entry *snd_info_create_entry(const char *name) 702static struct snd_info_entry *
703snd_info_create_entry(const char *name, struct snd_info_entry *parent)
701{ 704{
702 struct snd_info_entry *entry; 705 struct snd_info_entry *entry;
703 entry = kzalloc(sizeof(*entry), GFP_KERNEL); 706 entry = kzalloc(sizeof(*entry), GFP_KERNEL);
@@ -713,6 +716,9 @@ static struct snd_info_entry *snd_info_create_entry(const char *name)
713 mutex_init(&entry->access); 716 mutex_init(&entry->access);
714 INIT_LIST_HEAD(&entry->children); 717 INIT_LIST_HEAD(&entry->children);
715 INIT_LIST_HEAD(&entry->list); 718 INIT_LIST_HEAD(&entry->list);
719 entry->parent = parent;
720 if (parent)
721 list_add_tail(&entry->list, &parent->children);
716 return entry; 722 return entry;
717} 723}
718 724
@@ -730,13 +736,9 @@ struct snd_info_entry *snd_info_create_module_entry(struct module * module,
730 const char *name, 736 const char *name,
731 struct snd_info_entry *parent) 737 struct snd_info_entry *parent)
732{ 738{
733 struct snd_info_entry *entry = snd_info_create_entry(name); 739 struct snd_info_entry *entry = snd_info_create_entry(name, parent);
734 if (entry) { 740 if (entry)
735 entry->module = module; 741 entry->module = module;
736 entry->parent = parent;
737 if (parent)
738 list_add_tail(&entry->list, &parent->children);
739 }
740 return entry; 742 return entry;
741} 743}
742 744
@@ -756,13 +758,10 @@ struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card,
756 const char *name, 758 const char *name,
757 struct snd_info_entry * parent) 759 struct snd_info_entry * parent)
758{ 760{
759 struct snd_info_entry *entry = snd_info_create_entry(name); 761 struct snd_info_entry *entry = snd_info_create_entry(name, parent);
760 if (entry) { 762 if (entry) {
761 entry->module = card->module; 763 entry->module = card->module;
762 entry->card = card; 764 entry->card = card;
763 entry->parent = parent;
764 if (parent)
765 list_add_tail(&entry->list, &parent->children);
766 } 765 }
767 return entry; 766 return entry;
768} 767}