aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-06-23 08:37:59 -0400
committerJaroslav Kysela <perex@suse.cz>2006-09-23 04:36:48 -0400
commit746d4a02e68499fc6c1f8d0c43d2271853ade181 (patch)
treec4a1e9a0e8f5f95a44a3349d9b86490fe837428f /sound
parent42750b04c5baa7c5ffdf0a8be2b9b320efdf069f (diff)
[ALSA] Fix disconnection of proc interface
- Add the linked list to each proc entry to enable a single-shot disconnection (unregister) - Deprecate snd_info_unregister(), use snd_info_free_entry() - Removed NULL checks of snd_info_free_entry() Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/hwdep.c2
-rw-r--r--sound/core/info.c102
-rw-r--r--sound/core/info_oss.c6
-rw-r--r--sound/core/init.c7
-rw-r--r--sound/core/oss/mixer_oss.c6
-rw-r--r--sound/core/oss/pcm_oss.c8
-rw-r--r--sound/core/pcm.c53
-rw-r--r--sound/core/pcm_memory.c2
-rw-r--r--sound/core/rawmidi.c2
-rw-r--r--sound/core/seq/oss/seq_oss.c3
-rw-r--r--sound/core/seq/seq_device.c2
-rw-r--r--sound/core/seq/seq_info.c6
-rw-r--r--sound/core/sound.c3
-rw-r--r--sound/core/sound_oss.c3
-rw-r--r--sound/core/timer.c2
-rw-r--r--sound/drivers/opl4/opl4_proc.c3
-rw-r--r--sound/pci/ac97/ac97_proc.c18
-rw-r--r--sound/pci/cs46xx/dsp_spos.c52
-rw-r--r--sound/pci/cs46xx/dsp_spos_scb_lib.c2
-rw-r--r--sound/synth/emux/emux_proc.c6
20 files changed, 119 insertions, 169 deletions
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index 8bd0dcc93eba..cbd8a63282b6 100644
--- a/sound/core/hwdep.c
+++ b/sound/core/hwdep.c
@@ -497,7 +497,7 @@ static void __init snd_hwdep_proc_init(void)
497 497
498static void __exit snd_hwdep_proc_done(void) 498static void __exit snd_hwdep_proc_done(void)
499{ 499{
500 snd_info_unregister(snd_hwdep_proc_entry); 500 snd_info_free_entry(snd_hwdep_proc_entry);
501} 501}
502#else /* !CONFIG_PROC_FS */ 502#else /* !CONFIG_PROC_FS */
503#define snd_hwdep_proc_init() 503#define snd_hwdep_proc_init()
diff --git a/sound/core/info.c b/sound/core/info.c
index 340332c6d973..9663b6be9c3a 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -78,6 +78,7 @@ struct snd_info_private_data {
78 78
79static int snd_info_version_init(void); 79static int snd_info_version_init(void);
80static int snd_info_version_done(void); 80static int snd_info_version_done(void);
81static void snd_info_disconnect(struct snd_info_entry *entry);
81 82
82 83
83/* resize the proc r/w buffer */ 84/* resize the proc r/w buffer */
@@ -304,7 +305,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
304 mutex_lock(&info_mutex); 305 mutex_lock(&info_mutex);
305 p = PDE(inode); 306 p = PDE(inode);
306 entry = p == NULL ? NULL : (struct snd_info_entry *)p->data; 307 entry = p == NULL ? NULL : (struct snd_info_entry *)p->data;
307 if (entry == NULL || entry->disconnected) { 308 if (entry == NULL || ! entry->p) {
308 mutex_unlock(&info_mutex); 309 mutex_unlock(&info_mutex);
309 return -ENODEV; 310 return -ENODEV;
310 } 311 }
@@ -586,10 +587,10 @@ int __exit snd_info_done(void)
586 snd_info_version_done(); 587 snd_info_version_done();
587 if (snd_proc_root) { 588 if (snd_proc_root) {
588#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 589#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
589 snd_info_unregister(snd_seq_root); 590 snd_info_free_entry(snd_seq_root);
590#endif 591#endif
591#ifdef CONFIG_SND_OSSEMUL 592#ifdef CONFIG_SND_OSSEMUL
592 snd_info_unregister(snd_oss_root); 593 snd_info_free_entry(snd_oss_root);
593#endif 594#endif
594 snd_remove_proc_entry(&proc_root, snd_proc_root); 595 snd_remove_proc_entry(&proc_root, snd_proc_root);
595 } 596 }
@@ -648,17 +649,28 @@ int snd_info_card_register(struct snd_card *card)
648 * de-register the card proc file 649 * de-register the card proc file
649 * called from init.c 650 * called from init.c
650 */ 651 */
651int snd_info_card_free(struct snd_card *card) 652void snd_info_card_disconnect(struct snd_card *card)
652{ 653{
653 snd_assert(card != NULL, return -ENXIO); 654 snd_assert(card != NULL, return);
655 mutex_lock(&info_mutex);
654 if (card->proc_root_link) { 656 if (card->proc_root_link) {
655 snd_remove_proc_entry(snd_proc_root, card->proc_root_link); 657 snd_remove_proc_entry(snd_proc_root, card->proc_root_link);
656 card->proc_root_link = NULL; 658 card->proc_root_link = NULL;
657 } 659 }
658 if (card->proc_root) { 660 if (card->proc_root)
659 snd_info_unregister(card->proc_root); 661 snd_info_disconnect(card->proc_root);
660 card->proc_root = NULL; 662 mutex_unlock(&info_mutex);
661 } 663}
664
665/*
666 * release the card proc file resources
667 * called from init.c
668 */
669int snd_info_card_free(struct snd_card *card)
670{
671 snd_assert(card != NULL, return -ENXIO);
672 snd_info_free_entry(card->proc_root);
673 card->proc_root = NULL;
662 return 0; 674 return 0;
663} 675}
664 676
@@ -767,6 +779,8 @@ static struct snd_info_entry *snd_info_create_entry(const char *name)
767 entry->mode = S_IFREG | S_IRUGO; 779 entry->mode = S_IFREG | S_IRUGO;
768 entry->content = SNDRV_INFO_CONTENT_TEXT; 780 entry->content = SNDRV_INFO_CONTENT_TEXT;
769 mutex_init(&entry->access); 781 mutex_init(&entry->access);
782 INIT_LIST_HEAD(&entry->children);
783 INIT_LIST_HEAD(&entry->list);
770 return entry; 784 return entry;
771} 785}
772 786
@@ -819,30 +833,35 @@ struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card,
819 833
820EXPORT_SYMBOL(snd_info_create_card_entry); 834EXPORT_SYMBOL(snd_info_create_card_entry);
821 835
822static int snd_info_dev_free_entry(struct snd_device *device) 836static void snd_info_disconnect(struct snd_info_entry *entry)
823{ 837{
824 struct snd_info_entry *entry = device->device_data; 838 struct list_head *p, *n;
825 snd_info_free_entry(entry); 839 struct proc_dir_entry *root;
826 return 0;
827}
828 840
829static int snd_info_dev_register_entry(struct snd_device *device) 841 list_for_each_safe(p, n, &entry->children) {
830{ 842 snd_info_disconnect(list_entry(p, struct snd_info_entry, list));
831 struct snd_info_entry *entry = device->device_data; 843 }
832 return snd_info_register(entry); 844
845 if (! entry->p)
846 return;
847 list_del_init(&entry->list);
848 root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
849 snd_assert(root, return);
850 snd_remove_proc_entry(root, entry->p);
851 entry->p = NULL;
833} 852}
834 853
835static int snd_info_dev_disconnect_entry(struct snd_device *device) 854static int snd_info_dev_free_entry(struct snd_device *device)
836{ 855{
837 struct snd_info_entry *entry = device->device_data; 856 struct snd_info_entry *entry = device->device_data;
838 entry->disconnected = 1; 857 snd_info_free_entry(entry);
839 return 0; 858 return 0;
840} 859}
841 860
842static int snd_info_dev_unregister_entry(struct snd_device *device) 861static int snd_info_dev_register_entry(struct snd_device *device)
843{ 862{
844 struct snd_info_entry *entry = device->device_data; 863 struct snd_info_entry *entry = device->device_data;
845 return snd_info_unregister(entry); 864 return snd_info_register(entry);
846} 865}
847 866
848/** 867/**
@@ -871,8 +890,7 @@ int snd_card_proc_new(struct snd_card *card, const char *name,
871 static struct snd_device_ops ops = { 890 static struct snd_device_ops ops = {
872 .dev_free = snd_info_dev_free_entry, 891 .dev_free = snd_info_dev_free_entry,
873 .dev_register = snd_info_dev_register_entry, 892 .dev_register = snd_info_dev_register_entry,
874 .dev_disconnect = snd_info_dev_disconnect_entry, 893 /* disconnect is done via snd_info_card_disconnect() */
875 .dev_unregister = snd_info_dev_unregister_entry
876 }; 894 };
877 struct snd_info_entry *entry; 895 struct snd_info_entry *entry;
878 int err; 896 int err;
@@ -901,6 +919,11 @@ void snd_info_free_entry(struct snd_info_entry * entry)
901{ 919{
902 if (entry == NULL) 920 if (entry == NULL)
903 return; 921 return;
922 if (entry->p) {
923 mutex_lock(&info_mutex);
924 snd_info_disconnect(entry);
925 mutex_unlock(&info_mutex);
926 }
904 kfree(entry->name); 927 kfree(entry->name);
905 if (entry->private_free) 928 if (entry->private_free)
906 entry->private_free(entry); 929 entry->private_free(entry);
@@ -935,38 +958,14 @@ int snd_info_register(struct snd_info_entry * entry)
935 p->size = entry->size; 958 p->size = entry->size;
936 p->data = entry; 959 p->data = entry;
937 entry->p = p; 960 entry->p = p;
961 if (entry->parent)
962 list_add_tail(&entry->list, &entry->parent->children);
938 mutex_unlock(&info_mutex); 963 mutex_unlock(&info_mutex);
939 return 0; 964 return 0;
940} 965}
941 966
942EXPORT_SYMBOL(snd_info_register); 967EXPORT_SYMBOL(snd_info_register);
943 968
944/**
945 * snd_info_unregister - de-register the info entry
946 * @entry: the info entry
947 *
948 * De-registers the info entry and releases the instance.
949 *
950 * Returns zero if successful, or a negative error code on failure.
951 */
952int snd_info_unregister(struct snd_info_entry * entry)
953{
954 struct proc_dir_entry *root;
955
956 if (! entry)
957 return 0;
958 snd_assert(entry->p != NULL, return -ENXIO);
959 root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
960 snd_assert(root, return -ENXIO);
961 mutex_lock(&info_mutex);
962 snd_remove_proc_entry(root, entry->p);
963 mutex_unlock(&info_mutex);
964 snd_info_free_entry(entry);
965 return 0;
966}
967
968EXPORT_SYMBOL(snd_info_unregister);
969
970/* 969/*
971 970
972 */ 971 */
@@ -999,8 +998,7 @@ static int __init snd_info_version_init(void)
999 998
1000static int __exit snd_info_version_done(void) 999static int __exit snd_info_version_done(void)
1001{ 1000{
1002 if (snd_info_version_entry) 1001 snd_info_free_entry(snd_info_version_entry);
1003 snd_info_unregister(snd_info_version_entry);
1004 return 0; 1002 return 0;
1005} 1003}
1006 1004
diff --git a/sound/core/info_oss.c b/sound/core/info_oss.c
index bb2c40d0ab66..3ebc34919c76 100644
--- a/sound/core/info_oss.c
+++ b/sound/core/info_oss.c
@@ -131,10 +131,8 @@ int snd_info_minor_register(void)
131 131
132int snd_info_minor_unregister(void) 132int snd_info_minor_unregister(void)
133{ 133{
134 if (snd_sndstat_proc_entry) { 134 snd_info_free_entry(snd_sndstat_proc_entry);
135 snd_info_unregister(snd_sndstat_proc_entry); 135 snd_sndstat_proc_entry = NULL;
136 snd_sndstat_proc_entry = NULL;
137 }
138 return 0; 136 return 0;
139} 137}
140 138
diff --git a/sound/core/init.c b/sound/core/init.c
index 4d9258884e44..1ecb029ff4c9 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -310,6 +310,7 @@ int snd_card_disconnect(struct snd_card *card)
310 if (err < 0) 310 if (err < 0)
311 snd_printk(KERN_ERR "not all devices for card %i can be disconnected\n", card->number); 311 snd_printk(KERN_ERR "not all devices for card %i can be disconnected\n", card->number);
312 312
313 snd_info_card_disconnect(card);
313 return 0; 314 return 0;
314} 315}
315 316
@@ -360,7 +361,7 @@ int snd_card_free(struct snd_card *card)
360 } 361 }
361 if (card->private_free) 362 if (card->private_free)
362 card->private_free(card); 363 card->private_free(card);
363 snd_info_unregister(card->proc_id); 364 snd_info_free_entry(card->proc_id);
364 if (snd_info_card_free(card) < 0) { 365 if (snd_info_card_free(card) < 0) {
365 snd_printk(KERN_WARNING "unable to free card info\n"); 366 snd_printk(KERN_WARNING "unable to free card info\n");
366 /* Not fatal error */ 367 /* Not fatal error */
@@ -625,9 +626,9 @@ int __init snd_card_info_init(void)
625 626
626int __exit snd_card_info_done(void) 627int __exit snd_card_info_done(void)
627{ 628{
628 snd_info_unregister(snd_card_info_entry); 629 snd_info_free_entry(snd_card_info_entry);
629#ifdef MODULE 630#ifdef MODULE
630 snd_info_unregister(snd_card_module_info_entry); 631 snd_info_free_entry(snd_card_module_info_entry);
631#endif 632#endif
632 return 0; 633 return 0;
633} 634}
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index 75a9505c7445..00c95def95aa 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -1193,10 +1193,8 @@ static void snd_mixer_oss_proc_init(struct snd_mixer_oss *mixer)
1193 1193
1194static void snd_mixer_oss_proc_done(struct snd_mixer_oss *mixer) 1194static void snd_mixer_oss_proc_done(struct snd_mixer_oss *mixer)
1195{ 1195{
1196 if (mixer->proc_entry) { 1196 snd_info_free_entry(mixer->proc_entry);
1197 snd_info_unregister(mixer->proc_entry); 1197 mixer->proc_entry = NULL;
1198 mixer->proc_entry = NULL;
1199 }
1200} 1198}
1201#else /* !CONFIG_PROC_FS */ 1199#else /* !CONFIG_PROC_FS */
1202#define snd_mixer_oss_proc_init(mix) 1200#define snd_mixer_oss_proc_init(mix)
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 472fce0ee0e8..a92b93e5ebd5 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -2846,11 +2846,9 @@ static void snd_pcm_oss_proc_done(struct snd_pcm *pcm)
2846 int stream; 2846 int stream;
2847 for (stream = 0; stream < 2; ++stream) { 2847 for (stream = 0; stream < 2; ++stream) {
2848 struct snd_pcm_str *pstr = &pcm->streams[stream]; 2848 struct snd_pcm_str *pstr = &pcm->streams[stream];
2849 if (pstr->oss.proc_entry) { 2849 snd_info_free_entry(pstr->oss.proc_entry);
2850 snd_info_unregister(pstr->oss.proc_entry); 2850 pstr->oss.proc_entry = NULL;
2851 pstr->oss.proc_entry = NULL; 2851 snd_pcm_oss_proc_free_setup_list(pstr);
2852 snd_pcm_oss_proc_free_setup_list(pstr);
2853 }
2854 } 2852 }
2855} 2853}
2856#else /* !CONFIG_SND_VERBOSE_PROCFS */ 2854#else /* !CONFIG_SND_VERBOSE_PROCFS */
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 7581edd7b9ff..b8602471f7e5 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -494,19 +494,13 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
494static int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) 494static int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr)
495{ 495{
496#ifdef CONFIG_SND_PCM_XRUN_DEBUG 496#ifdef CONFIG_SND_PCM_XRUN_DEBUG
497 if (pstr->proc_xrun_debug_entry) { 497 snd_info_free_entry(pstr->proc_xrun_debug_entry);
498 snd_info_unregister(pstr->proc_xrun_debug_entry); 498 pstr->proc_xrun_debug_entry = NULL;
499 pstr->proc_xrun_debug_entry = NULL;
500 }
501#endif 499#endif
502 if (pstr->proc_info_entry) { 500 snd_info_free_entry(pstr->proc_info_entry);
503 snd_info_unregister(pstr->proc_info_entry); 501 pstr->proc_info_entry = NULL;
504 pstr->proc_info_entry = NULL; 502 snd_info_free_entry(pstr->proc_root);
505 } 503 pstr->proc_root = NULL;
506 if (pstr->proc_root) {
507 snd_info_unregister(pstr->proc_root);
508 pstr->proc_root = NULL;
509 }
510 return 0; 504 return 0;
511} 505}
512 506
@@ -570,29 +564,19 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
570 564
571 return 0; 565 return 0;
572} 566}
573 567
574static int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream) 568static int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream)
575{ 569{
576 if (substream->proc_info_entry) { 570 snd_info_free_entry(substream->proc_info_entry);
577 snd_info_unregister(substream->proc_info_entry); 571 substream->proc_info_entry = NULL;
578 substream->proc_info_entry = NULL; 572 snd_info_free_entry(substream->proc_hw_params_entry);
579 } 573 substream->proc_hw_params_entry = NULL;
580 if (substream->proc_hw_params_entry) { 574 snd_info_free_entry(substream->proc_sw_params_entry);
581 snd_info_unregister(substream->proc_hw_params_entry); 575 substream->proc_sw_params_entry = NULL;
582 substream->proc_hw_params_entry = NULL; 576 snd_info_free_entry(substream->proc_status_entry);
583 } 577 substream->proc_status_entry = NULL;
584 if (substream->proc_sw_params_entry) { 578 snd_info_free_entry(substream->proc_root);
585 snd_info_unregister(substream->proc_sw_params_entry); 579 substream->proc_root = NULL;
586 substream->proc_sw_params_entry = NULL;
587 }
588 if (substream->proc_status_entry) {
589 snd_info_unregister(substream->proc_status_entry);
590 substream->proc_status_entry = NULL;
591 }
592 if (substream->proc_root) {
593 snd_info_unregister(substream->proc_root);
594 substream->proc_root = NULL;
595 }
596 return 0; 580 return 0;
597} 581}
598#else /* !CONFIG_SND_VERBOSE_PROCFS */ 582#else /* !CONFIG_SND_VERBOSE_PROCFS */
@@ -1090,8 +1074,7 @@ static void snd_pcm_proc_init(void)
1090 1074
1091static void snd_pcm_proc_done(void) 1075static void snd_pcm_proc_done(void)
1092{ 1076{
1093 if (snd_pcm_proc_entry) 1077 snd_info_free_entry(snd_pcm_proc_entry);
1094 snd_info_unregister(snd_pcm_proc_entry);
1095} 1078}
1096 1079
1097#else /* !CONFIG_PROC_FS */ 1080#else /* !CONFIG_PROC_FS */
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index 067d2056db9a..be030cb4d373 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -101,7 +101,7 @@ int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream)
101{ 101{
102 snd_pcm_lib_preallocate_dma_free(substream); 102 snd_pcm_lib_preallocate_dma_free(substream);
103#ifdef CONFIG_SND_VERBOSE_PROCFS 103#ifdef CONFIG_SND_VERBOSE_PROCFS
104 snd_info_unregister(substream->proc_prealloc_entry); 104 snd_info_free_entry(substream->proc_prealloc_entry);
105 substream->proc_prealloc_entry = NULL; 105 substream->proc_prealloc_entry = NULL;
106#endif 106#endif
107 return 0; 107 return 0;
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 8c15c66eb4aa..51577c22f8ce 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -1599,7 +1599,7 @@ static int snd_rawmidi_dev_unregister(struct snd_device *device)
1599 mutex_lock(&register_mutex); 1599 mutex_lock(&register_mutex);
1600 list_del(&rmidi->list); 1600 list_del(&rmidi->list);
1601 if (rmidi->proc_entry) { 1601 if (rmidi->proc_entry) {
1602 snd_info_unregister(rmidi->proc_entry); 1602 snd_info_free_entry(rmidi->proc_entry);
1603 rmidi->proc_entry = NULL; 1603 rmidi->proc_entry = NULL;
1604 } 1604 }
1605#ifdef CONFIG_SND_OSSEMUL 1605#ifdef CONFIG_SND_OSSEMUL
diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c
index e7234135641c..92858cf8b6eb 100644
--- a/sound/core/seq/oss/seq_oss.c
+++ b/sound/core/seq/oss/seq_oss.c
@@ -303,8 +303,7 @@ register_proc(void)
303static void 303static void
304unregister_proc(void) 304unregister_proc(void)
305{ 305{
306 if (info_entry) 306 snd_info_free_entry(info_entry);
307 snd_info_unregister(info_entry);
308 info_entry = NULL; 307 info_entry = NULL;
309} 308}
310#endif /* CONFIG_PROC_FS */ 309#endif /* CONFIG_PROC_FS */
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c
index 102ff548ce69..b85954e956d4 100644
--- a/sound/core/seq/seq_device.c
+++ b/sound/core/seq/seq_device.c
@@ -573,7 +573,7 @@ static void __exit alsa_seq_device_exit(void)
573{ 573{
574 remove_drivers(); 574 remove_drivers();
575#ifdef CONFIG_PROC_FS 575#ifdef CONFIG_PROC_FS
576 snd_info_unregister(info_entry); 576 snd_info_free_entry(info_entry);
577#endif 577#endif
578 if (num_ops) 578 if (num_ops)
579 snd_printk(KERN_ERR "drivers not released (%d)\n", num_ops); 579 snd_printk(KERN_ERR "drivers not released (%d)\n", num_ops);
diff --git a/sound/core/seq/seq_info.c b/sound/core/seq/seq_info.c
index 142e9e6882c9..8a7fe5cca1c9 100644
--- a/sound/core/seq/seq_info.c
+++ b/sound/core/seq/seq_info.c
@@ -64,9 +64,9 @@ int __init snd_seq_info_init(void)
64 64
65int __exit snd_seq_info_done(void) 65int __exit snd_seq_info_done(void)
66{ 66{
67 snd_info_unregister(queues_entry); 67 snd_info_free_entry(queues_entry);
68 snd_info_unregister(clients_entry); 68 snd_info_free_entry(clients_entry);
69 snd_info_unregister(timer_entry); 69 snd_info_free_entry(timer_entry);
70 return 0; 70 return 0;
71} 71}
72#endif 72#endif
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 7edd1fc58b17..b4430db3fa4c 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -387,8 +387,7 @@ int __init snd_minor_info_init(void)
387 387
388int __exit snd_minor_info_done(void) 388int __exit snd_minor_info_done(void)
389{ 389{
390 if (snd_minor_info_entry) 390 snd_info_free_entry(snd_minor_info_entry);
391 snd_info_unregister(snd_minor_info_entry);
392 return 0; 391 return 0;
393} 392}
394#endif /* CONFIG_PROC_FS */ 393#endif /* CONFIG_PROC_FS */
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index 74f0fe5a1ba0..b2fc40aa520b 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -270,8 +270,7 @@ int __init snd_minor_info_oss_init(void)
270 270
271int __exit snd_minor_info_oss_done(void) 271int __exit snd_minor_info_oss_done(void)
272{ 272{
273 if (snd_minor_info_oss_entry) 273 snd_info_free_entry(snd_minor_info_oss_entry);
274 snd_info_unregister(snd_minor_info_oss_entry);
275 return 0; 274 return 0;
276} 275}
277#endif /* CONFIG_PROC_FS */ 276#endif /* CONFIG_PROC_FS */
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 0a984e881c10..52ecbe1e9abb 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -1126,7 +1126,7 @@ static void __init snd_timer_proc_init(void)
1126 1126
1127static void __exit snd_timer_proc_done(void) 1127static void __exit snd_timer_proc_done(void)
1128{ 1128{
1129 snd_info_unregister(snd_timer_proc_entry); 1129 snd_info_free_entry(snd_timer_proc_entry);
1130} 1130}
1131#else /* !CONFIG_PROC_FS */ 1131#else /* !CONFIG_PROC_FS */
1132#define snd_timer_proc_init() 1132#define snd_timer_proc_init()
diff --git a/sound/drivers/opl4/opl4_proc.c b/sound/drivers/opl4/opl4_proc.c
index e552ec34166f..11dd811771a4 100644
--- a/sound/drivers/opl4/opl4_proc.c
+++ b/sound/drivers/opl4/opl4_proc.c
@@ -159,8 +159,7 @@ int snd_opl4_create_proc(struct snd_opl4 *opl4)
159 159
160void snd_opl4_free_proc(struct snd_opl4 *opl4) 160void snd_opl4_free_proc(struct snd_opl4 *opl4)
161{ 161{
162 if (opl4->proc_entry) 162 snd_info_free_entry(opl4->proc_entry);
163 snd_info_unregister(opl4->proc_entry);
164} 163}
165 164
166#endif /* CONFIG_PROC_FS */ 165#endif /* CONFIG_PROC_FS */
diff --git a/sound/pci/ac97/ac97_proc.c b/sound/pci/ac97/ac97_proc.c
index 2118df50b9d6..a3fdd7da911c 100644
--- a/sound/pci/ac97/ac97_proc.c
+++ b/sound/pci/ac97/ac97_proc.c
@@ -457,14 +457,10 @@ void snd_ac97_proc_init(struct snd_ac97 * ac97)
457 457
458void snd_ac97_proc_done(struct snd_ac97 * ac97) 458void snd_ac97_proc_done(struct snd_ac97 * ac97)
459{ 459{
460 if (ac97->proc_regs) { 460 snd_info_free_entry(ac97->proc_regs);
461 snd_info_unregister(ac97->proc_regs); 461 ac97->proc_regs = NULL;
462 ac97->proc_regs = NULL; 462 snd_info_free_entry(ac97->proc);
463 } 463 ac97->proc = NULL;
464 if (ac97->proc) {
465 snd_info_unregister(ac97->proc);
466 ac97->proc = NULL;
467 }
468} 464}
469 465
470void snd_ac97_bus_proc_init(struct snd_ac97_bus * bus) 466void snd_ac97_bus_proc_init(struct snd_ac97_bus * bus)
@@ -485,8 +481,6 @@ void snd_ac97_bus_proc_init(struct snd_ac97_bus * bus)
485 481
486void snd_ac97_bus_proc_done(struct snd_ac97_bus * bus) 482void snd_ac97_bus_proc_done(struct snd_ac97_bus * bus)
487{ 483{
488 if (bus->proc) { 484 snd_info_free_entry(bus->proc);
489 snd_info_unregister(bus->proc); 485 bus->proc = NULL;
490 bus->proc = NULL;
491 }
492} 486}
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index 5c9711c0265c..89c402770a1d 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -868,35 +868,23 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)
868 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 868 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
869 int i; 869 int i;
870 870
871 if (ins->proc_sym_info_entry) { 871 snd_info_free_entry(ins->proc_sym_info_entry);
872 snd_info_unregister(ins->proc_sym_info_entry); 872 ins->proc_sym_info_entry = NULL;
873 ins->proc_sym_info_entry = NULL; 873
874 } 874 snd_info_free_entry(ins->proc_modules_info_entry);
875 875 ins->proc_modules_info_entry = NULL;
876 if (ins->proc_modules_info_entry) { 876
877 snd_info_unregister(ins->proc_modules_info_entry); 877 snd_info_free_entry(ins->proc_parameter_dump_info_entry);
878 ins->proc_modules_info_entry = NULL; 878 ins->proc_parameter_dump_info_entry = NULL;
879 } 879
880 880 snd_info_free_entry(ins->proc_sample_dump_info_entry);
881 if (ins->proc_parameter_dump_info_entry) { 881 ins->proc_sample_dump_info_entry = NULL;
882 snd_info_unregister(ins->proc_parameter_dump_info_entry); 882
883 ins->proc_parameter_dump_info_entry = NULL; 883 snd_info_free_entry(ins->proc_scb_info_entry);
884 } 884 ins->proc_scb_info_entry = NULL;
885 885
886 if (ins->proc_sample_dump_info_entry) { 886 snd_info_free_entry(ins->proc_task_info_entry);
887 snd_info_unregister(ins->proc_sample_dump_info_entry); 887 ins->proc_task_info_entry = NULL;
888 ins->proc_sample_dump_info_entry = NULL;
889 }
890
891 if (ins->proc_scb_info_entry) {
892 snd_info_unregister(ins->proc_scb_info_entry);
893 ins->proc_scb_info_entry = NULL;
894 }
895
896 if (ins->proc_task_info_entry) {
897 snd_info_unregister(ins->proc_task_info_entry);
898 ins->proc_task_info_entry = NULL;
899 }
900 888
901 mutex_lock(&chip->spos_mutex); 889 mutex_lock(&chip->spos_mutex);
902 for (i = 0; i < ins->nscb; ++i) { 890 for (i = 0; i < ins->nscb; ++i) {
@@ -905,10 +893,8 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)
905 } 893 }
906 mutex_unlock(&chip->spos_mutex); 894 mutex_unlock(&chip->spos_mutex);
907 895
908 if (ins->proc_dsp_dir) { 896 snd_info_free_entry(ins->proc_dsp_dir);
909 snd_info_unregister (ins->proc_dsp_dir); 897 ins->proc_dsp_dir = NULL;
910 ins->proc_dsp_dir = NULL;
911 }
912 898
913 return 0; 899 return 0;
914} 900}
diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c
index 232b337852ff..343f51d5311b 100644
--- a/sound/pci/cs46xx/dsp_spos_scb_lib.c
+++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c
@@ -233,7 +233,7 @@ void cs46xx_dsp_proc_free_scb_desc (struct dsp_scb_descriptor * scb)
233 233
234 snd_printdd("cs46xx_dsp_proc_free_scb_desc: freeing %s\n",scb->scb_name); 234 snd_printdd("cs46xx_dsp_proc_free_scb_desc: freeing %s\n",scb->scb_name);
235 235
236 snd_info_unregister(scb->proc_info); 236 snd_info_free_entry(scb->proc_info);
237 scb->proc_info = NULL; 237 scb->proc_info = NULL;
238 238
239 snd_assert (scb_info != NULL, return); 239 snd_assert (scb_info != NULL, return);
diff --git a/sound/synth/emux/emux_proc.c b/sound/synth/emux/emux_proc.c
index 58b9601f3ad0..59144ec026e4 100644
--- a/sound/synth/emux/emux_proc.c
+++ b/sound/synth/emux/emux_proc.c
@@ -128,10 +128,8 @@ void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device)
128 128
129void snd_emux_proc_free(struct snd_emux *emu) 129void snd_emux_proc_free(struct snd_emux *emu)
130{ 130{
131 if (emu->proc) { 131 snd_info_free_entry(emu->proc);
132 snd_info_unregister(emu->proc); 132 emu->proc = NULL;
133 emu->proc = NULL;
134 }
135} 133}
136 134
137#endif /* CONFIG_PROC_FS */ 135#endif /* CONFIG_PROC_FS */