[ALSA] Optimize for config without PROC_FS (seq and oss parts)
authorTakashi Iwai <tiwai@suse.de>
Thu, 1 Dec 2005 09:43:51 +0000 (10:43 +0100)
committerJaroslav Kysela <perex@suse.cz>
Tue, 3 Jan 2006 11:30:05 +0000 (12:30 +0100)
Modules: ALSA<-OSS emulation,ALSA sequencer,ALSA<-OSS sequencer

Optimize the code when compiled without CONFIG_PROC_FS (in seq and oss
emulation parts).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
13 files changed:
sound/core/oss/mixer_oss.c
sound/core/oss/pcm_oss.c
sound/core/seq/oss/seq_oss.c
sound/core/seq/oss/seq_oss_init.c
sound/core/seq/oss/seq_oss_midi.c
sound/core/seq/oss/seq_oss_readq.c
sound/core/seq/oss/seq_oss_synth.c
sound/core/seq/seq_clientmgr.c
sound/core/seq/seq_device.c
sound/core/seq/seq_info.c
sound/core/seq/seq_info.h
sound/core/seq/seq_queue.c
sound/core/seq/seq_timer.c

index 2d7a42014f5116519a37b81ba60a0c77cd0c3b57..f08e65a2bffe7d0225e6393c3650f768a26ea612 100644 (file)
@@ -1053,6 +1053,7 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, struct snd_mix
        return 0;
 }
 
+#ifdef CONFIG_PROC_FS
 /*
  */
 #define MIXER_VOL(name) [SOUND_MIXER_##name] = #name
@@ -1200,6 +1201,10 @@ static void snd_mixer_oss_proc_done(struct snd_mixer_oss *mixer)
                mixer->proc_entry = NULL;
        }
 }
+#else /* !CONFIG_PROC_FS */
+#define snd_mixer_oss_proc_init(mix)
+#define snd_mixer_oss_proc_done(mix)
+#endif /* CONFIG_PROC_FS */
 
 static void snd_mixer_oss_build(struct snd_mixer_oss *mixer)
 {
index 2ae283c7b28a0c09fa767950322ec91092589914..16df1246a131c75ce45d02e0c181d93f473fee69 100644 (file)
@@ -2269,6 +2269,7 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
        return 0;
 }
 
+#ifdef CONFIG_PROC_FS
 /*
  *  /proc interface
  */
@@ -2420,6 +2421,10 @@ static void snd_pcm_oss_proc_done(struct snd_pcm *pcm)
                }
        }
 }
+#else /* !CONFIG_PROC_FS */
+#define snd_pcm_oss_proc_init(pcm)
+#define snd_pcm_oss_proc_done(pcm)
+#endif /* CONFIG_PROC_FS */
 
 /*
  *  ENTRY functions
index 4b51ab56507bd00920deea775f60580ebfba3237..c98f0ba13810d7a6c1cf7d0483a5933f33be9f9a 100644 (file)
@@ -52,8 +52,13 @@ int seq_oss_debug = 0;
  */
 static int register_device(void);
 static void unregister_device(void);
+#ifdef CONFIG_PROC_FS
 static int register_proc(void);
 static void unregister_proc(void);
+#else
+static inline int register_proc(void) { return 0; }
+static inline void unregister_proc(void) {}
+#endif
 
 static int odev_open(struct inode *inode, struct file *file);
 static int odev_release(struct inode *inode, struct file *file);
@@ -61,9 +66,6 @@ static ssize_t odev_read(struct file *file, char __user *buf, size_t count, loff
 static ssize_t odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset);
 static long odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 static unsigned int odev_poll(struct file *file, poll_table * wait);
-#ifdef CONFIG_PROC_FS
-static void info_read(struct snd_info_entry *entry, struct snd_info_buffer *buf);
-#endif
 
 
 /*
@@ -276,12 +278,10 @@ info_read(struct snd_info_entry *entry, struct snd_info_buffer *buf)
        up(&register_mutex);
 }
 
-#endif /* CONFIG_PROC_FS */
 
 static int __init
 register_proc(void)
 {
-#ifdef CONFIG_PROC_FS
        struct snd_info_entry *entry;
 
        entry = snd_info_create_module_entry(THIS_MODULE, SNDRV_SEQ_OSS_PROCNAME, snd_seq_root);
@@ -297,16 +297,14 @@ register_proc(void)
                return -ENOMEM;
        }
        info_entry = entry;
-#endif
        return 0;
 }
 
 static void
 unregister_proc(void)
 {
-#ifdef CONFIG_PROC_FS
        if (info_entry)
                snd_info_unregister(info_entry);
        info_entry = NULL;
-#endif
 }
+#endif /* CONFIG_PROC_FS */
index 1d4473eadcf3088cb093c02eb9e5bbffc92eb29b..97e2493e931fc385c2ba50338ebc4960a35633fe 100644 (file)
@@ -502,6 +502,7 @@ snd_seq_oss_reset(struct seq_oss_devinfo *dp)
 }
 
 
+#ifdef CONFIG_PROC_FS
 /*
  * misc. functions for proc interface
  */
@@ -552,4 +553,4 @@ snd_seq_oss_system_info_read(struct snd_info_buffer *buf)
                        snd_seq_oss_readq_info_read(dp->readq, buf);
        }
 }
-
+#endif /* CONFIG_PROC_FS */
index eb7ae990965c3816bbb8ad517bdd8dfaec5e029b..0a711d2d04f0f3736572844698b8bc0ff389b384 100644 (file)
@@ -668,6 +668,7 @@ snd_seq_oss_midi_make_info(struct seq_oss_devinfo *dp, int dev, struct midi_info
 }
 
 
+#ifdef CONFIG_PROC_FS
 /*
  * proc interface
  */
@@ -707,4 +708,4 @@ snd_seq_oss_midi_info_read(struct snd_info_buffer *buf)
                snd_use_lock_free(&mdev->use_lock);
        }
 }
-
+#endif /* CONFIG_PROC_FS */
index abc70078add33502826eb40efe650a36a6130ed2..f5de79f29f1e1a2aae91ede5d1bec3a65675fbdd 100644 (file)
@@ -222,6 +222,7 @@ snd_seq_oss_readq_put_timestamp(struct seq_oss_readq *q, unsigned long curt, int
 }
 
 
+#ifdef CONFIG_PROC_FS
 /*
  * proc interface
  */
@@ -232,3 +233,4 @@ snd_seq_oss_readq_info_read(struct seq_oss_readq *q, struct snd_info_buffer *buf
                    (waitqueue_active(&q->midi_sleep) ? "sleeping":"running"),
                    q->qlen, q->input_time);
 }
+#endif /* CONFIG_PROC_FS */
index 0b6025c92b9e0a46c3ca10656f3a2aa3c068f07a..ab570a0a6183650105021644c9e988bb2ccdf64d 100644 (file)
@@ -621,6 +621,7 @@ snd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_in
 }
 
 
+#ifdef CONFIG_PROC_FS
 /*
  * proc interface
  */
@@ -648,4 +649,4 @@ snd_seq_oss_synth_info_read(struct snd_info_buffer *buf)
                snd_use_lock_free(&rec->use_lock);
        }
 }
-
+#endif /* CONFIG_PROC_FS */
index 2a9c6b316b140c1ee38a29b43eaa6280d240bcf7..9c32fd262f8de6c2bf466c44b1ecdd49cff936bc 100644 (file)
@@ -2413,6 +2413,7 @@ int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table
 
 /*---------------------------------------------------------------------------*/
 
+#ifdef CONFIG_PROC_FS
 /*
  *  /proc interface
  */
@@ -2518,7 +2519,7 @@ void snd_seq_info_clients_read(struct snd_info_entry *entry,
                snd_seq_client_unlock(client);
        }
 }
-
+#endif /* CONFIG_PROC_FS */
 
 /*---------------------------------------------------------------------------*/
 
index 3f935a18b5e7c612aff9c019a504f7f8f6bef4b0..9ece443fba5599058c5e71e564f5af21159f38c3 100644 (file)
@@ -78,7 +78,9 @@ struct ops_list {
 static LIST_HEAD(opslist);
 static int num_ops;
 static DECLARE_MUTEX(ops_mutex);
+#ifdef CONFIG_PROC_FS
 static struct snd_info_entry *info_entry = NULL;
+#endif
 
 /*
  * prototypes
@@ -100,6 +102,7 @@ static void remove_drivers(void);
  * show all drivers and their status
  */
 
+#ifdef CONFIG_PROC_FS
 static void snd_seq_device_info(struct snd_info_entry *entry,
                                struct snd_info_buffer *buffer)
 {
@@ -117,6 +120,7 @@ static void snd_seq_device_info(struct snd_info_entry *entry,
        }
        up(&ops_mutex); 
 }
+#endif
  
 /*
  * load all registered drivers (called from seq_clientmgr.c)
@@ -544,6 +548,7 @@ static void unlock_driver(struct ops_list *ops)
 
 static int __init alsa_seq_device_init(void)
 {
+#ifdef CONFIG_PROC_FS
        info_entry = snd_info_create_module_entry(THIS_MODULE, "drivers",
                                                  snd_seq_root);
        if (info_entry == NULL)
@@ -555,13 +560,16 @@ static int __init alsa_seq_device_init(void)
                snd_info_free_entry(info_entry);
                return -ENOMEM;
        }
+#endif
        return 0;
 }
 
 static void __exit alsa_seq_device_exit(void)
 {
        remove_drivers();
+#ifdef CONFIG_PROC_FS
        snd_info_unregister(info_entry);
+#endif
        if (num_ops)
                snd_printk(KERN_ERR "drivers not released (%d)\n", num_ops);
 }
index 3257cf4ec258f31045ce2b04bc35afd01774357d..acce21afdaa47a84e753fa428282e4dc00533ba4 100644 (file)
@@ -27,7 +27,7 @@
 #include "seq_clientmgr.h"
 #include "seq_timer.h"
 
-
+#ifdef CONFIG_PROC_FS
 static struct snd_info_entry *queues_entry;
 static struct snd_info_entry *clients_entry;
 static struct snd_info_entry *timer_entry;
@@ -52,7 +52,6 @@ create_info_entry(char *name, int size, void (*read)(struct snd_info_entry *,
        return entry;
 }
 
-
 /* create all our /proc entries */
 int __init snd_seq_info_init(void)
 {
@@ -66,11 +65,9 @@ int __init snd_seq_info_init(void)
 
 int __exit snd_seq_info_done(void)
 {
-       if (queues_entry)
-               snd_info_unregister(queues_entry);
-       if (clients_entry)
-               snd_info_unregister(clients_entry);
-       if (timer_entry)
-               snd_info_unregister(timer_entry);
+       snd_info_unregister(queues_entry);
+       snd_info_unregister(clients_entry);
+       snd_info_unregister(timer_entry);
        return 0;
 }
+#endif
index 5a91ebce43a0eb080e38d02cbf1f414a7072e58a..4892a7f35c08fc012c14d80484ccb3402ca3cf91 100644 (file)
@@ -29,8 +29,12 @@ void snd_seq_info_timer_read(struct snd_info_entry *entry, struct snd_info_buffe
 void snd_seq_info_queues_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer);
 
 
+#ifdef CONFIG_PROC_FS
 int snd_seq_info_init( void );
 int snd_seq_info_done( void );
-
+#else
+static inline int snd_seq_info_init(void) { return 0; }
+static inline int snd_seq_info_done(void) { return 0; }
+#endif
 
 #endif
index b537a71e1e19f7b61aef3943f6a1861ca4d2980c..9cf20f0455426d50945c96ca6c80f3d857309782 100644 (file)
@@ -756,6 +756,7 @@ int snd_seq_control_queue(struct snd_seq_event *ev, int atomic, int hop)
 
 /*----------------------------------------------------------------*/
 
+#ifdef CONFIG_PROC_FS
 /* exported to seq_info.c */
 void snd_seq_info_queues_read(struct snd_info_entry *entry, 
                              struct snd_info_buffer *buffer)
@@ -789,3 +790,5 @@ void snd_seq_info_queues_read(struct snd_info_entry *entry,
                queuefree(q);
        }
 }
+#endif /* CONFIG_PROC_FS */
+
index a1d8bfd60ae91af026f84e80300dc310a26a64ae..b4b9a132cb165ef35f0d656d5a00525c555d77f0 100644 (file)
@@ -425,6 +425,7 @@ snd_seq_tick_time_t snd_seq_timer_get_cur_tick(struct snd_seq_timer *tmr)
 }
 
 
+#ifdef CONFIG_PROC_FS
 /* exported to seq_info.c */
 void snd_seq_info_timer_read(struct snd_info_entry *entry,
                             struct snd_info_buffer *buffer)
@@ -451,3 +452,5 @@ void snd_seq_info_timer_read(struct snd_info_entry *entry,
                queuefree(q);
        }
 }
+#endif /* CONFIG_PROC_FS */
+