Commit 04f141a8800d022981f0405a8d307c98aba55105
Committed by
Jaroslav Kysela
1 parent
e28563cceb
Exists in
master
and in
7 other branches
[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>
Showing 13 changed files with 50 additions and 21 deletions Side-by-side Diff
- 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
sound/core/oss/mixer_oss.c
... | ... | @@ -1053,6 +1053,7 @@ |
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 |
... | ... | @@ -1200,6 +1201,10 @@ |
1200 | 1201 | mixer->proc_entry = NULL; |
1201 | 1202 | } |
1202 | 1203 | } |
1204 | +#else /* !CONFIG_PROC_FS */ | |
1205 | +#define snd_mixer_oss_proc_init(mix) | |
1206 | +#define snd_mixer_oss_proc_done(mix) | |
1207 | +#endif /* CONFIG_PROC_FS */ | |
1203 | 1208 | |
1204 | 1209 | static void snd_mixer_oss_build(struct snd_mixer_oss *mixer) |
1205 | 1210 | { |
sound/core/oss/pcm_oss.c
... | ... | @@ -2269,6 +2269,7 @@ |
2269 | 2269 | return 0; |
2270 | 2270 | } |
2271 | 2271 | |
2272 | +#ifdef CONFIG_PROC_FS | |
2272 | 2273 | /* |
2273 | 2274 | * /proc interface |
2274 | 2275 | */ |
... | ... | @@ -2420,6 +2421,10 @@ |
2420 | 2421 | } |
2421 | 2422 | } |
2422 | 2423 | } |
2424 | +#else /* !CONFIG_PROC_FS */ | |
2425 | +#define snd_pcm_oss_proc_init(pcm) | |
2426 | +#define snd_pcm_oss_proc_done(pcm) | |
2427 | +#endif /* CONFIG_PROC_FS */ | |
2423 | 2428 | |
2424 | 2429 | /* |
2425 | 2430 | * ENTRY functions |
sound/core/seq/oss/seq_oss.c
... | ... | @@ -52,8 +52,13 @@ |
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); |
... | ... | @@ -61,9 +66,6 @@ |
61 | 66 | static ssize_t odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset); |
62 | 67 | static long odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
63 | 68 | static unsigned int odev_poll(struct file *file, poll_table * wait); |
64 | -#ifdef CONFIG_PROC_FS | |
65 | -static void info_read(struct snd_info_entry *entry, struct snd_info_buffer *buf); | |
66 | -#endif | |
67 | 69 | |
68 | 70 | |
69 | 71 | /* |
70 | 72 | |
... | ... | @@ -276,12 +278,10 @@ |
276 | 278 | up(®ister_mutex); |
277 | 279 | } |
278 | 280 | |
279 | -#endif /* CONFIG_PROC_FS */ | |
280 | 281 | |
281 | 282 | static int __init |
282 | 283 | register_proc(void) |
283 | 284 | { |
284 | -#ifdef CONFIG_PROC_FS | |
285 | 285 | struct snd_info_entry *entry; |
286 | 286 | |
287 | 287 | entry = snd_info_create_module_entry(THIS_MODULE, SNDRV_SEQ_OSS_PROCNAME, snd_seq_root); |
288 | 288 | |
289 | 289 | |
290 | 290 | |
... | ... | @@ -297,17 +297,15 @@ |
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 */ |
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
... | ... | @@ -2413,6 +2413,7 @@ |
2413 | 2413 | |
2414 | 2414 | /*---------------------------------------------------------------------------*/ |
2415 | 2415 | |
2416 | +#ifdef CONFIG_PROC_FS | |
2416 | 2417 | /* |
2417 | 2418 | * /proc interface |
2418 | 2419 | */ |
... | ... | @@ -2518,7 +2519,7 @@ |
2518 | 2519 | snd_seq_client_unlock(client); |
2519 | 2520 | } |
2520 | 2521 | } |
2521 | - | |
2522 | +#endif /* CONFIG_PROC_FS */ | |
2522 | 2523 | |
2523 | 2524 | /*---------------------------------------------------------------------------*/ |
2524 | 2525 |
sound/core/seq/seq_device.c
... | ... | @@ -78,7 +78,9 @@ |
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 |
... | ... | @@ -100,6 +102,7 @@ |
100 | 102 | * show all drivers and their status |
101 | 103 | */ |
102 | 104 | |
105 | +#ifdef CONFIG_PROC_FS | |
103 | 106 | static void snd_seq_device_info(struct snd_info_entry *entry, |
104 | 107 | struct snd_info_buffer *buffer) |
105 | 108 | { |
... | ... | @@ -117,6 +120,7 @@ |
117 | 120 | } |
118 | 121 | up(&ops_mutex); |
119 | 122 | } |
123 | +#endif | |
120 | 124 | |
121 | 125 | /* |
122 | 126 | * load all registered drivers (called from seq_clientmgr.c) |
... | ... | @@ -544,6 +548,7 @@ |
544 | 548 | |
545 | 549 | static int __init alsa_seq_device_init(void) |
546 | 550 | { |
551 | +#ifdef CONFIG_PROC_FS | |
547 | 552 | info_entry = snd_info_create_module_entry(THIS_MODULE, "drivers", |
548 | 553 | snd_seq_root); |
549 | 554 | if (info_entry == NULL) |
550 | 555 | |
551 | 556 | |
... | ... | @@ -555,13 +560,16 @@ |
555 | 560 | snd_info_free_entry(info_entry); |
556 | 561 | return -ENOMEM; |
557 | 562 | } |
563 | +#endif | |
558 | 564 | return 0; |
559 | 565 | } |
560 | 566 | |
561 | 567 | static void __exit alsa_seq_device_exit(void) |
562 | 568 | { |
563 | 569 | remove_drivers(); |
570 | +#ifdef CONFIG_PROC_FS | |
564 | 571 | snd_info_unregister(info_entry); |
572 | +#endif | |
565 | 573 | if (num_ops) |
566 | 574 | snd_printk(KERN_ERR "drivers not released (%d)\n", num_ops); |
567 | 575 | } |
sound/core/seq/seq_info.c
... | ... | @@ -27,7 +27,7 @@ |
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,7 +52,6 @@ |
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 | { |
59 | 58 | |
... | ... | @@ -66,12 +65,10 @@ |
66 | 65 | |
67 | 66 | int __exit snd_seq_info_done(void) |
68 | 67 | { |
69 | - if (queues_entry) | |
70 | - snd_info_unregister(queues_entry); | |
71 | - if (clients_entry) | |
72 | - snd_info_unregister(clients_entry); | |
73 | - if (timer_entry) | |
74 | - snd_info_unregister(timer_entry); | |
68 | + snd_info_unregister(queues_entry); | |
69 | + snd_info_unregister(clients_entry); | |
70 | + snd_info_unregister(timer_entry); | |
75 | 71 | return 0; |
76 | 72 | } |
73 | +#endif |
sound/core/seq/seq_info.h
... | ... | @@ -29,9 +29,13 @@ |
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 |
sound/core/seq/seq_queue.c
... | ... | @@ -756,6 +756,7 @@ |
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) |
... | ... | @@ -789,4 +790,5 @@ |
789 | 790 | queuefree(q); |
790 | 791 | } |
791 | 792 | } |
793 | +#endif /* CONFIG_PROC_FS */ |
sound/core/seq/seq_timer.c
... | ... | @@ -425,6 +425,7 @@ |
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) |
... | ... | @@ -451,4 +452,5 @@ |
451 | 452 | queuefree(q); |
452 | 453 | } |
453 | 454 | } |
455 | +#endif /* CONFIG_PROC_FS */ |