aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/timer.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-12-01 04:42:42 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:30:02 -0500
commite28563cceb9f258ebe3c50fc27d8f4ff0ac4bfa4 (patch)
treeb69095abb998dedc2953368ba2c75978d80f644a /sound/core/timer.c
parent7cd01dd840824e7c6023ad1dbfdb94a2183a7adb (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.c48
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)
1052 return snd_timer_global_register(timer); 1052 return snd_timer_global_register(timer);
1053} 1053}
1054 1054
1055#ifdef CONFIG_PROC_FS
1055/* 1056/*
1056 * Info interface 1057 * Info interface
1057 */ 1058 */
@@ -1107,6 +1108,33 @@ static void snd_timer_proc_read(struct snd_info_entry *entry,
1107 up(&register_mutex); 1108 up(&register_mutex);
1108} 1109}
1109 1110
1111static struct snd_info_entry *snd_timer_proc_entry = NULL;
1112
1113static void __init snd_timer_proc_init(void)
1114{
1115 struct snd_info_entry *entry;
1116
1117 entry = snd_info_create_module_entry(THIS_MODULE, "timers", NULL);
1118 if (entry != NULL) {
1119 entry->c.text.read_size = SNDRV_TIMER_DEVICES * 128;
1120 entry->c.text.read = snd_timer_proc_read;
1121 if (snd_info_register(entry) < 0) {
1122 snd_info_free_entry(entry);
1123 entry = NULL;
1124 }
1125 }
1126 snd_timer_proc_entry = entry;
1127}
1128
1129static void __exit snd_timer_proc_done(void)
1130{
1131 snd_info_unregister(snd_timer_proc_entry);
1132}
1133#else /* !CONFIG_PROC_FS */
1134#define snd_timer_proc_init()
1135#define snd_timer_proc_done()
1136#endif
1137
1110/* 1138/*
1111 * USER SPACE interface 1139 * USER SPACE interface
1112 */ 1140 */
@@ -1928,27 +1956,15 @@ static struct file_operations snd_timer_f_ops =
1928 * ENTRY functions 1956 * ENTRY functions
1929 */ 1957 */
1930 1958
1931static struct snd_info_entry *snd_timer_proc_entry = NULL;
1932
1933static int __init alsa_timer_init(void) 1959static int __init alsa_timer_init(void)
1934{ 1960{
1935 int err; 1961 int err;
1936 struct snd_info_entry *entry;
1937 1962
1938#ifdef SNDRV_OSS_INFO_DEV_TIMERS 1963#ifdef SNDRV_OSS_INFO_DEV_TIMERS
1939 snd_oss_info_register(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1, 1964 snd_oss_info_register(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1,
1940 "system timer"); 1965 "system timer");
1941#endif 1966#endif
1942 entry = snd_info_create_module_entry(THIS_MODULE, "timers", NULL); 1967
1943 if (entry != NULL) {
1944 entry->c.text.read_size = SNDRV_TIMER_DEVICES * 128;
1945 entry->c.text.read = snd_timer_proc_read;
1946 if (snd_info_register(entry) < 0) {
1947 snd_info_free_entry(entry);
1948 entry = NULL;
1949 }
1950 }
1951 snd_timer_proc_entry = entry;
1952 if ((err = snd_timer_register_system()) < 0) 1968 if ((err = snd_timer_register_system()) < 0)
1953 snd_printk(KERN_ERR "unable to register system timer (%i)\n", 1969 snd_printk(KERN_ERR "unable to register system timer (%i)\n",
1954 err); 1970 err);
@@ -1956,6 +1972,7 @@ static int __init alsa_timer_init(void)
1956 &snd_timer_f_ops, NULL, "timer")) < 0) 1972 &snd_timer_f_ops, NULL, "timer")) < 0)
1957 snd_printk(KERN_ERR "unable to register timer device (%i)\n", 1973 snd_printk(KERN_ERR "unable to register timer device (%i)\n",
1958 err); 1974 err);
1975 snd_timer_proc_init();
1959 return 0; 1976 return 0;
1960} 1977}
1961 1978
@@ -1969,10 +1986,7 @@ static void __exit alsa_timer_exit(void)
1969 struct snd_timer *timer = list_entry(p, struct snd_timer, device_list); 1986 struct snd_timer *timer = list_entry(p, struct snd_timer, device_list);
1970 snd_timer_unregister(timer); 1987 snd_timer_unregister(timer);
1971 } 1988 }
1972 if (snd_timer_proc_entry) { 1989 snd_timer_proc_done();
1973 snd_info_unregister(snd_timer_proc_entry);
1974 snd_timer_proc_entry = NULL;
1975 }
1976#ifdef SNDRV_OSS_INFO_DEV_TIMERS 1990#ifdef SNDRV_OSS_INFO_DEV_TIMERS
1977 snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1); 1991 snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1);
1978#endif 1992#endif