@@ -78,14 +78,13 @@ struct snd_info_private_data {
7878};
7979
8080static int snd_info_version_init (void );
81- static int snd_info_version_done (void );
8281static void snd_info_disconnect (struct snd_info_entry * entry );
8382
8483/*
8584
8685 */
8786
88- static struct proc_dir_entry * snd_proc_root ;
87+ static struct snd_info_entry * snd_proc_root ;
8988struct snd_info_entry * snd_seq_root ;
9089EXPORT_SYMBOL (snd_seq_root );
9190
@@ -462,14 +461,17 @@ static struct snd_info_entry *create_subdir(struct module *mod,
462461 return entry ;
463462}
464463
464+ static struct snd_info_entry * snd_info_create_entry (const char * name );
465+
465466int __init snd_info_init (void )
466467{
467- struct proc_dir_entry * p ;
468-
469- p = proc_mkdir ("asound" , NULL );
470- if (p == NULL )
468+ snd_proc_root = snd_info_create_entry ("asound" );
469+ if (!snd_proc_root )
471470 return - ENOMEM ;
472- snd_proc_root = p ;
471+ snd_proc_root -> mode = S_IFDIR | S_IRUGO | S_IXUGO ;
472+ snd_proc_root -> p = proc_mkdir ("asound" , NULL );
473+ if (!snd_proc_root -> p )
474+ goto error ;
473475#ifdef CONFIG_SND_OSSEMUL
474476 snd_oss_root = create_subdir (THIS_MODULE , "oss" );
475477 if (!snd_oss_root )
@@ -487,10 +489,7 @@ int __init snd_info_init(void)
487489 return 0 ;
488490
489491 error :
490- #ifdef CONFIG_SND_OSSEMUL
491- snd_info_free_entry (snd_oss_root );
492- #endif
493- proc_remove (snd_proc_root );
492+ snd_info_free_entry (snd_proc_root );
494493 return - ENOMEM ;
495494}
496495
@@ -499,24 +498,10 @@ int __exit snd_info_done(void)
499498 snd_card_info_done ();
500499 snd_minor_info_oss_done ();
501500 snd_minor_info_done ();
502- snd_info_version_done ();
503- if (snd_proc_root ) {
504- #if IS_ENABLED (CONFIG_SND_SEQUENCER )
505- snd_info_free_entry (snd_seq_root );
506- #endif
507- #ifdef CONFIG_SND_OSSEMUL
508- snd_info_free_entry (snd_oss_root );
509- #endif
510- proc_remove (snd_proc_root );
511- }
501+ snd_info_free_entry (snd_proc_root );
512502 return 0 ;
513503}
514504
515- /*
516-
517- */
518-
519-
520505/*
521506 * create a card proc file
522507 * called from init.c
@@ -551,7 +536,7 @@ int snd_info_card_register(struct snd_card *card)
551536 if (!strcmp (card -> id , card -> proc_root -> name ))
552537 return 0 ;
553538
554- p = proc_symlink (card -> id , snd_proc_root , card -> proc_root -> name );
539+ p = proc_symlink (card -> id , snd_proc_root -> p , card -> proc_root -> name );
555540 if (p == NULL )
556541 return - ENOMEM ;
557542 card -> proc_root_link = p ;
@@ -570,7 +555,7 @@ void snd_info_card_id_change(struct snd_card *card)
570555 }
571556 if (strcmp (card -> id , card -> proc_root -> name ))
572557 card -> proc_root_link = proc_symlink (card -> id ,
573- snd_proc_root ,
558+ snd_proc_root -> p ,
574559 card -> proc_root -> name );
575560 mutex_unlock (& info_mutex );
576561}
@@ -815,7 +800,7 @@ int snd_info_register(struct snd_info_entry * entry)
815800
816801 if (snd_BUG_ON (!entry ))
817802 return - ENXIO ;
818- root = entry -> parent == NULL ? snd_proc_root : entry -> parent -> p ;
803+ root = entry -> parent == NULL ? snd_proc_root -> p : entry -> parent -> p ;
819804 mutex_lock (& info_mutex );
820805 if (S_ISDIR (entry -> mode )) {
821806 p = proc_mkdir_mode (entry -> name , entry -> mode , root );
@@ -850,8 +835,6 @@ EXPORT_SYMBOL(snd_info_register);
850835
851836 */
852837
853- static struct snd_info_entry * snd_info_version_entry ;
854-
855838static void snd_info_version_read (struct snd_info_entry * entry , struct snd_info_buffer * buffer )
856839{
857840 snd_iprintf (buffer ,
@@ -871,13 +854,6 @@ static int __init snd_info_version_init(void)
871854 snd_info_free_entry (entry );
872855 return - ENOMEM ;
873856 }
874- snd_info_version_entry = entry ;
875- return 0 ;
876- }
877-
878- static int __exit snd_info_version_done (void )
879- {
880- snd_info_free_entry (snd_info_version_entry );
881857 return 0 ;
882858}
883859
0 commit comments