ALSA: core: Clean up OSS proc file management
A few minor cleanups: - Move the call of snd_info_minor_register() into snd_info_init() so that we can call all proc-related stuff in a shot - Add missing __init prefix to snd_info_minor_register() - Return an error properly from snd_oss_info_register() - Drop snd_info_minor_unregister() that is superfluous now Acked-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Родитель
85d1431807
Коммит
a0dca822e9
|
@ -94,10 +94,8 @@ struct snd_info_entry {
|
||||||
|
|
||||||
#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
|
#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
|
||||||
int snd_info_minor_register(void);
|
int snd_info_minor_register(void);
|
||||||
int snd_info_minor_unregister(void);
|
|
||||||
#else
|
#else
|
||||||
#define snd_info_minor_register() /* NOP */
|
#define snd_info_minor_register() 0
|
||||||
#define snd_info_minor_unregister() /* NOP */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -479,7 +479,8 @@ int __init snd_info_init(void)
|
||||||
if (snd_info_version_init() < 0 ||
|
if (snd_info_version_init() < 0 ||
|
||||||
snd_minor_info_init() < 0 ||
|
snd_minor_info_init() < 0 ||
|
||||||
snd_minor_info_oss_init() < 0 ||
|
snd_minor_info_oss_init() < 0 ||
|
||||||
snd_card_info_init() < 0)
|
snd_card_info_init() < 0 ||
|
||||||
|
snd_info_minor_register() < 0)
|
||||||
goto error;
|
goto error;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
|
|
||||||
static DEFINE_MUTEX(strings);
|
static DEFINE_MUTEX(strings);
|
||||||
static char *snd_sndstat_strings[SNDRV_CARDS][SNDRV_OSS_INFO_DEV_COUNT];
|
static char *snd_sndstat_strings[SNDRV_CARDS][SNDRV_OSS_INFO_DEV_COUNT];
|
||||||
static struct snd_info_entry *snd_sndstat_proc_entry;
|
|
||||||
|
|
||||||
int snd_oss_info_register(int dev, int num, char *string)
|
int snd_oss_info_register(int dev, int num, char *string)
|
||||||
{
|
{
|
||||||
|
@ -110,25 +109,15 @@ static void snd_sndstat_proc_read(struct snd_info_entry *entry,
|
||||||
snd_sndstat_show_strings(buffer, "Mixers", SNDRV_OSS_INFO_DEV_MIXERS);
|
snd_sndstat_show_strings(buffer, "Mixers", SNDRV_OSS_INFO_DEV_MIXERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int snd_info_minor_register(void)
|
int __init snd_info_minor_register(void)
|
||||||
{
|
{
|
||||||
struct snd_info_entry *entry;
|
struct snd_info_entry *entry;
|
||||||
|
|
||||||
memset(snd_sndstat_strings, 0, sizeof(snd_sndstat_strings));
|
memset(snd_sndstat_strings, 0, sizeof(snd_sndstat_strings));
|
||||||
if ((entry = snd_info_create_module_entry(THIS_MODULE, "sndstat", snd_oss_root)) != NULL) {
|
entry = snd_info_create_module_entry(THIS_MODULE, "sndstat",
|
||||||
entry->c.text.read = snd_sndstat_proc_read;
|
snd_oss_root);
|
||||||
if (snd_info_register(entry) < 0) {
|
if (!entry)
|
||||||
snd_info_free_entry(entry);
|
return -ENOMEM;
|
||||||
entry = NULL;
|
entry->c.text.read = snd_sndstat_proc_read;
|
||||||
}
|
return snd_info_register(entry); /* freed in error path */
|
||||||
}
|
|
||||||
snd_sndstat_proc_entry = entry;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int snd_info_minor_unregister(void)
|
|
||||||
{
|
|
||||||
snd_info_free_entry(snd_sndstat_proc_entry);
|
|
||||||
snd_sndstat_proc_entry = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -409,7 +409,6 @@ static int __init alsa_sound_init(void)
|
||||||
unregister_chrdev(major, "alsa");
|
unregister_chrdev(major, "alsa");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
snd_info_minor_register();
|
|
||||||
#ifndef MODULE
|
#ifndef MODULE
|
||||||
pr_info("Advanced Linux Sound Architecture Driver Initialized.\n");
|
pr_info("Advanced Linux Sound Architecture Driver Initialized.\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -418,7 +417,6 @@ static int __init alsa_sound_init(void)
|
||||||
|
|
||||||
static void __exit alsa_sound_exit(void)
|
static void __exit alsa_sound_exit(void)
|
||||||
{
|
{
|
||||||
snd_info_minor_unregister();
|
|
||||||
snd_info_done();
|
snd_info_done();
|
||||||
unregister_chrdev(major, "alsa");
|
unregister_chrdev(major, "alsa");
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче