diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-12-01 10:42:42 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 12:30:02 +0100 |
commit | e28563cceb9f258ebe3c50fc27d8f4ff0ac4bfa4 (patch) | |
tree | b69095abb998dedc2953368ba2c75978d80f644a /sound/core/timer.c | |
parent | 7cd01dd840824e7c6023ad1dbfdb94a2183a7adb (diff) |
[ALSA] Optimize for config without PROC_FS
Modules: HWDEP Midlevel,ALSA Core,PCM Midlevel,Timer Midlevel
Optimize the code when compiled without CONFIG_PROC_FS.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/timer.c')
-rw-r--r-- | sound/core/timer.c | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c index c62dbacdca13..2425b971b240 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1052,6 +1052,7 @@ static int snd_timer_register_system(void) return snd_timer_global_register(timer); } +#ifdef CONFIG_PROC_FS /* * Info interface */ @@ -1107,6 +1108,33 @@ static void snd_timer_proc_read(struct snd_info_entry *entry, up(®ister_mutex); } +static struct snd_info_entry *snd_timer_proc_entry = NULL; + +static void __init snd_timer_proc_init(void) +{ + struct snd_info_entry *entry; + + entry = snd_info_create_module_entry(THIS_MODULE, "timers", NULL); + if (entry != NULL) { + entry->c.text.read_size = SNDRV_TIMER_DEVICES * 128; + entry->c.text.read = snd_timer_proc_read; + if (snd_info_register(entry) < 0) { + snd_info_free_entry(entry); + entry = NULL; + } + } + snd_timer_proc_entry = entry; +} + +static void __exit snd_timer_proc_done(void) +{ + snd_info_unregister(snd_timer_proc_entry); +} +#else /* !CONFIG_PROC_FS */ +#define snd_timer_proc_init() +#define snd_timer_proc_done() +#endif + /* * USER SPACE interface */ @@ -1928,27 +1956,15 @@ static struct file_operations snd_timer_f_ops = * ENTRY functions */ -static struct snd_info_entry *snd_timer_proc_entry = NULL; - static int __init alsa_timer_init(void) { int err; - struct snd_info_entry *entry; #ifdef SNDRV_OSS_INFO_DEV_TIMERS snd_oss_info_register(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1, "system timer"); #endif - entry = snd_info_create_module_entry(THIS_MODULE, "timers", NULL); - if (entry != NULL) { - entry->c.text.read_size = SNDRV_TIMER_DEVICES * 128; - entry->c.text.read = snd_timer_proc_read; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } - } - snd_timer_proc_entry = entry; + if ((err = snd_timer_register_system()) < 0) snd_printk(KERN_ERR "unable to register system timer (%i)\n", err); @@ -1956,6 +1972,7 @@ static int __init alsa_timer_init(void) &snd_timer_f_ops, NULL, "timer")) < 0) snd_printk(KERN_ERR "unable to register timer device (%i)\n", err); + snd_timer_proc_init(); return 0; } @@ -1969,10 +1986,7 @@ static void __exit alsa_timer_exit(void) struct snd_timer *timer = list_entry(p, struct snd_timer, device_list); snd_timer_unregister(timer); } - if (snd_timer_proc_entry) { - snd_info_unregister(snd_timer_proc_entry); - snd_timer_proc_entry = NULL; - } + snd_timer_proc_done(); #ifdef SNDRV_OSS_INFO_DEV_TIMERS snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1); #endif |