Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[ALSA] Optimize for config without PROC_FS (seq and oss parts)

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>

authored by

Takashi Iwai and committed by
Jaroslav Kysela
04f141a8 e28563cc

+50 -21
+5
sound/core/oss/mixer_oss.c
··· 1053 1053 return 0; 1054 1054 } 1055 1055 1056 + #ifdef CONFIG_PROC_FS 1056 1057 /* 1057 1058 */ 1058 1059 #define MIXER_VOL(name) [SOUND_MIXER_##name] = #name ··· 1201 1200 mixer->proc_entry = NULL; 1202 1201 } 1203 1202 } 1203 + #else /* !CONFIG_PROC_FS */ 1204 + #define snd_mixer_oss_proc_init(mix) 1205 + #define snd_mixer_oss_proc_done(mix) 1206 + #endif /* CONFIG_PROC_FS */ 1204 1207 1205 1208 static void snd_mixer_oss_build(struct snd_mixer_oss *mixer) 1206 1209 {
+5
sound/core/oss/pcm_oss.c
··· 2269 2269 return 0; 2270 2270 } 2271 2271 2272 + #ifdef CONFIG_PROC_FS 2272 2273 /* 2273 2274 * /proc interface 2274 2275 */ ··· 2421 2420 } 2422 2421 } 2423 2422 } 2423 + #else /* !CONFIG_PROC_FS */ 2424 + #define snd_pcm_oss_proc_init(pcm) 2425 + #define snd_pcm_oss_proc_done(pcm) 2426 + #endif /* CONFIG_PROC_FS */ 2424 2427 2425 2428 /* 2426 2429 * ENTRY functions
+6 -8
sound/core/seq/oss/seq_oss.c
··· 52 52 */ 53 53 static int register_device(void); 54 54 static void unregister_device(void); 55 + #ifdef CONFIG_PROC_FS 55 56 static int register_proc(void); 56 57 static void unregister_proc(void); 58 + #else 59 + static inline int register_proc(void) { return 0; } 60 + static inline void unregister_proc(void) {} 61 + #endif 57 62 58 63 static int odev_open(struct inode *inode, struct file *file); 59 64 static int odev_release(struct inode *inode, struct file *file); ··· 66 61 static ssize_t odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset); 67 62 static long odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 68 63 static unsigned int odev_poll(struct file *file, poll_table * wait); 69 - #ifdef CONFIG_PROC_FS 70 - static void info_read(struct snd_info_entry *entry, struct snd_info_buffer *buf); 71 - #endif 72 64 73 65 74 66 /* ··· 278 276 up(&register_mutex); 279 277 } 280 278 281 - #endif /* CONFIG_PROC_FS */ 282 279 283 280 static int __init 284 281 register_proc(void) 285 282 { 286 - #ifdef CONFIG_PROC_FS 287 283 struct snd_info_entry *entry; 288 284 289 285 entry = snd_info_create_module_entry(THIS_MODULE, SNDRV_SEQ_OSS_PROCNAME, snd_seq_root); ··· 297 297 return -ENOMEM; 298 298 } 299 299 info_entry = entry; 300 - #endif 301 300 return 0; 302 301 } 303 302 304 303 static void 305 304 unregister_proc(void) 306 305 { 307 - #ifdef CONFIG_PROC_FS 308 306 if (info_entry) 309 307 snd_info_unregister(info_entry); 310 308 info_entry = NULL; 311 - #endif 312 309 } 310 + #endif /* CONFIG_PROC_FS */
+2 -1
sound/core/seq/oss/seq_oss_init.c
··· 502 502 } 503 503 504 504 505 + #ifdef CONFIG_PROC_FS 505 506 /* 506 507 * misc. functions for proc interface 507 508 */ ··· 553 552 snd_seq_oss_readq_info_read(dp->readq, buf); 554 553 } 555 554 } 556 - 555 + #endif /* CONFIG_PROC_FS */
+2 -1
sound/core/seq/oss/seq_oss_midi.c
··· 668 668 } 669 669 670 670 671 + #ifdef CONFIG_PROC_FS 671 672 /* 672 673 * proc interface 673 674 */ ··· 708 707 snd_use_lock_free(&mdev->use_lock); 709 708 } 710 709 } 711 - 710 + #endif /* CONFIG_PROC_FS */
+2
sound/core/seq/oss/seq_oss_readq.c
··· 222 222 } 223 223 224 224 225 + #ifdef CONFIG_PROC_FS 225 226 /* 226 227 * proc interface 227 228 */ ··· 233 232 (waitqueue_active(&q->midi_sleep) ? "sleeping":"running"), 234 233 q->qlen, q->input_time); 235 234 } 235 + #endif /* CONFIG_PROC_FS */
+2 -1
sound/core/seq/oss/seq_oss_synth.c
··· 621 621 } 622 622 623 623 624 + #ifdef CONFIG_PROC_FS 624 625 /* 625 626 * proc interface 626 627 */ ··· 649 648 snd_use_lock_free(&rec->use_lock); 650 649 } 651 650 } 652 - 651 + #endif /* CONFIG_PROC_FS */
+2 -1
sound/core/seq/seq_clientmgr.c
··· 2413 2413 2414 2414 /*---------------------------------------------------------------------------*/ 2415 2415 2416 + #ifdef CONFIG_PROC_FS 2416 2417 /* 2417 2418 * /proc interface 2418 2419 */ ··· 2519 2518 snd_seq_client_unlock(client); 2520 2519 } 2521 2520 } 2522 - 2521 + #endif /* CONFIG_PROC_FS */ 2523 2522 2524 2523 /*---------------------------------------------------------------------------*/ 2525 2524
+8
sound/core/seq/seq_device.c
··· 78 78 static LIST_HEAD(opslist); 79 79 static int num_ops; 80 80 static DECLARE_MUTEX(ops_mutex); 81 + #ifdef CONFIG_PROC_FS 81 82 static struct snd_info_entry *info_entry = NULL; 83 + #endif 82 84 83 85 /* 84 86 * prototypes ··· 102 100 * show all drivers and their status 103 101 */ 104 102 103 + #ifdef CONFIG_PROC_FS 105 104 static void snd_seq_device_info(struct snd_info_entry *entry, 106 105 struct snd_info_buffer *buffer) 107 106 { ··· 120 117 } 121 118 up(&ops_mutex); 122 119 } 120 + #endif 123 121 124 122 /* 125 123 * load all registered drivers (called from seq_clientmgr.c) ··· 548 544 549 545 static int __init alsa_seq_device_init(void) 550 546 { 547 + #ifdef CONFIG_PROC_FS 551 548 info_entry = snd_info_create_module_entry(THIS_MODULE, "drivers", 552 549 snd_seq_root); 553 550 if (info_entry == NULL) ··· 560 555 snd_info_free_entry(info_entry); 561 556 return -ENOMEM; 562 557 } 558 + #endif 563 559 return 0; 564 560 } 565 561 566 562 static void __exit alsa_seq_device_exit(void) 567 563 { 568 564 remove_drivers(); 565 + #ifdef CONFIG_PROC_FS 569 566 snd_info_unregister(info_entry); 567 + #endif 570 568 if (num_ops) 571 569 snd_printk(KERN_ERR "drivers not released (%d)\n", num_ops); 572 570 }
+5 -8
sound/core/seq/seq_info.c
··· 27 27 #include "seq_clientmgr.h" 28 28 #include "seq_timer.h" 29 29 30 - 30 + #ifdef CONFIG_PROC_FS 31 31 static struct snd_info_entry *queues_entry; 32 32 static struct snd_info_entry *clients_entry; 33 33 static struct snd_info_entry *timer_entry; ··· 52 52 return entry; 53 53 } 54 54 55 - 56 55 /* create all our /proc entries */ 57 56 int __init snd_seq_info_init(void) 58 57 { ··· 65 66 66 67 int __exit snd_seq_info_done(void) 67 68 { 68 - if (queues_entry) 69 - snd_info_unregister(queues_entry); 70 - if (clients_entry) 71 - snd_info_unregister(clients_entry); 72 - if (timer_entry) 73 - snd_info_unregister(timer_entry); 69 + snd_info_unregister(queues_entry); 70 + snd_info_unregister(clients_entry); 71 + snd_info_unregister(timer_entry); 74 72 return 0; 75 73 } 74 + #endif
+5 -1
sound/core/seq/seq_info.h
··· 29 29 void snd_seq_info_queues_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer); 30 30 31 31 32 + #ifdef CONFIG_PROC_FS 32 33 int snd_seq_info_init( void ); 33 34 int snd_seq_info_done( void ); 34 - 35 + #else 36 + static inline int snd_seq_info_init(void) { return 0; } 37 + static inline int snd_seq_info_done(void) { return 0; } 38 + #endif 35 39 36 40 #endif
+3
sound/core/seq/seq_queue.c
··· 756 756 757 757 /*----------------------------------------------------------------*/ 758 758 759 + #ifdef CONFIG_PROC_FS 759 760 /* exported to seq_info.c */ 760 761 void snd_seq_info_queues_read(struct snd_info_entry *entry, 761 762 struct snd_info_buffer *buffer) ··· 790 789 queuefree(q); 791 790 } 792 791 } 792 + #endif /* CONFIG_PROC_FS */ 793 +
+3
sound/core/seq/seq_timer.c
··· 425 425 } 426 426 427 427 428 + #ifdef CONFIG_PROC_FS 428 429 /* exported to seq_info.c */ 429 430 void snd_seq_info_timer_read(struct snd_info_entry *entry, 430 431 struct snd_info_buffer *buffer) ··· 452 451 queuefree(q); 453 452 } 454 453 } 454 + #endif /* CONFIG_PROC_FS */ 455 +