aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/init.c')
-rw-r--r--sound/core/init.c51
1 files changed, 13 insertions, 38 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index 04734e047bfe..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,
107 snd_iprintf(buffer, "%s\n", entry->card->id); 107 snd_iprintf(buffer, "%s\n", entry->card->id);
108} 108}
109 109
110static inline int init_info_for_card(struct snd_card *card) 110static int init_info_for_card(struct snd_card *card)
111{ 111{
112 int err; 112 int err;
113 struct snd_info_entry *entry; 113 struct snd_info_entry *entry;
114 114
115 if ((err = snd_info_card_register(card)) < 0) { 115 entry = snd_info_create_card_entry(card, "id", card->proc_root);
116 dev_dbg(card->dev, "unable to create card info\n"); 116 if (!entry) {
117 return err;
118 }
119 if ((entry = snd_info_create_card_entry(card, "id", card->proc_root)) == NULL) {
120 dev_dbg(card->dev, "unable to create card entry\n"); 117 dev_dbg(card->dev, "unable to create card entry\n");
121 return err; 118 return err;
122 } 119 }
123 entry->c.text.read = snd_card_id_read; 120 entry->c.text.read = snd_card_id_read;
124 if (snd_info_register(entry) < 0) {
125 snd_info_free_entry(entry);
126 entry = NULL;
127 }
128 card->proc_id = entry; 121 card->proc_id = entry;
129 return 0; 122
123 return snd_info_card_register(card);
130} 124}
131#else /* !CONFIG_PROC_FS */ 125#else /* !CONFIG_PROC_FS */
132#define init_info_for_card(card) 126#define init_info_for_card(card)
@@ -756,7 +750,7 @@ int snd_card_register(struct snd_card *card)
756 if (snd_cards[card->number]) { 750 if (snd_cards[card->number]) {
757 /* already registered */ 751 /* already registered */
758 mutex_unlock(&snd_card_mutex); 752 mutex_unlock(&snd_card_mutex);
759 return 0; 753 return snd_info_card_register(card); /* register pending info */
760 } 754 }
761 if (*card->id) { 755 if (*card->id) {
762 /* make a unique id name from the given string */ 756 /* make a unique id name from the given string */
@@ -783,8 +777,6 @@ int snd_card_register(struct snd_card *card)
783EXPORT_SYMBOL(snd_card_register); 777EXPORT_SYMBOL(snd_card_register);
784 778
785#ifdef CONFIG_PROC_FS 779#ifdef CONFIG_PROC_FS
786static struct snd_info_entry *snd_card_info_entry;
787
788static void snd_card_info_read(struct snd_info_entry *entry, 780static void snd_card_info_read(struct snd_info_entry *entry,
789 struct snd_info_buffer *buffer) 781 struct snd_info_buffer *buffer)
790{ 782{
@@ -810,7 +802,6 @@ static void snd_card_info_read(struct snd_info_entry *entry,
810} 802}
811 803
812#ifdef CONFIG_SND_OSSEMUL 804#ifdef CONFIG_SND_OSSEMUL
813
814void snd_card_info_read_oss(struct snd_info_buffer *buffer) 805void snd_card_info_read_oss(struct snd_info_buffer *buffer)
815{ 806{
816 int idx, count; 807 int idx, count;
@@ -832,7 +823,6 @@ void snd_card_info_read_oss(struct snd_info_buffer *buffer)
832#endif 823#endif
833 824
834#ifdef MODULE 825#ifdef MODULE
835static struct snd_info_entry *snd_card_module_info_entry;
836static void snd_card_module_info_read(struct snd_info_entry *entry, 826static void snd_card_module_info_read(struct snd_info_entry *entry,
837 struct snd_info_buffer *buffer) 827 struct snd_info_buffer *buffer)
838{ 828{
@@ -857,35 +847,20 @@ int __init snd_card_info_init(void)
857 if (! entry) 847 if (! entry)
858 return -ENOMEM; 848 return -ENOMEM;
859 entry->c.text.read = snd_card_info_read; 849 entry->c.text.read = snd_card_info_read;
860 if (snd_info_register(entry) < 0) { 850 if (snd_info_register(entry) < 0)
861 snd_info_free_entry(entry); 851 return -ENOMEM; /* freed in error path */
862 return -ENOMEM;
863 }
864 snd_card_info_entry = entry;
865 852
866#ifdef MODULE 853#ifdef MODULE
867 entry = snd_info_create_module_entry(THIS_MODULE, "modules", NULL); 854 entry = snd_info_create_module_entry(THIS_MODULE, "modules", NULL);
868 if (entry) { 855 if (!entry)
869 entry->c.text.read = snd_card_module_info_read; 856 return -ENOMEM;
870 if (snd_info_register(entry) < 0) 857 entry->c.text.read = snd_card_module_info_read;
871 snd_info_free_entry(entry); 858 if (snd_info_register(entry) < 0)
872 else 859 return -ENOMEM; /* freed in error path */
873 snd_card_module_info_entry = entry;
874 }
875#endif 860#endif
876 861
877 return 0; 862 return 0;
878} 863}
879
880int __exit snd_card_info_done(void)
881{
882 snd_info_free_entry(snd_card_info_entry);
883#ifdef MODULE
884 snd_info_free_entry(snd_card_module_info_entry);
885#endif
886 return 0;
887}
888
889#endif /* CONFIG_PROC_FS */ 864#endif /* CONFIG_PROC_FS */
890 865
891/** 866/**