diff options
Diffstat (limited to 'sound/sound_core.c')
-rw-r--r-- | sound/sound_core.c | 79 |
1 files changed, 60 insertions, 19 deletions
diff --git a/sound/sound_core.c b/sound/sound_core.c index 1b04259a4328..68614c3ed541 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c | |||
@@ -1,5 +1,61 @@ | |||
1 | /* | 1 | /* |
2 | * Sound core handling. Breaks out sound functions to submodules | 2 | * Sound core. This file is composed of two parts. sound_class |
3 | * which is common to both OSS and ALSA and OSS sound core which | ||
4 | * is used OSS or emulation of it. | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * First, the common part. | ||
9 | */ | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/device.h> | ||
12 | #include <linux/err.h> | ||
13 | |||
14 | #ifdef CONFIG_SOUND_OSS_CORE | ||
15 | static int __init init_oss_soundcore(void); | ||
16 | static void __exit cleanup_oss_soundcore(void); | ||
17 | #else | ||
18 | static inline int init_oss_soundcore(void) { return 0; } | ||
19 | static inline void cleanup_oss_soundcore(void) { } | ||
20 | #endif | ||
21 | |||
22 | struct class *sound_class; | ||
23 | EXPORT_SYMBOL(sound_class); | ||
24 | |||
25 | MODULE_DESCRIPTION("Core sound module"); | ||
26 | MODULE_AUTHOR("Alan Cox"); | ||
27 | MODULE_LICENSE("GPL"); | ||
28 | |||
29 | static int __init init_soundcore(void) | ||
30 | { | ||
31 | int rc; | ||
32 | |||
33 | rc = init_oss_soundcore(); | ||
34 | if (rc) | ||
35 | return rc; | ||
36 | |||
37 | sound_class = class_create(THIS_MODULE, "sound"); | ||
38 | if (IS_ERR(sound_class)) { | ||
39 | cleanup_oss_soundcore(); | ||
40 | return PTR_ERR(sound_class); | ||
41 | } | ||
42 | |||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | static void __exit cleanup_soundcore(void) | ||
47 | { | ||
48 | cleanup_oss_soundcore(); | ||
49 | class_destroy(sound_class); | ||
50 | } | ||
51 | |||
52 | module_init(init_soundcore); | ||
53 | module_exit(cleanup_soundcore); | ||
54 | |||
55 | |||
56 | #ifdef CONFIG_SOUND_OSS_CORE | ||
57 | /* | ||
58 | * OSS sound core handling. Breaks out sound functions to submodules | ||
3 | * | 59 | * |
4 | * Author: Alan Cox <alan.cox@linux.org> | 60 | * Author: Alan Cox <alan.cox@linux.org> |
5 | * | 61 | * |
@@ -34,21 +90,17 @@ | |||
34 | * locking at some point in 2.3.x. | 90 | * locking at some point in 2.3.x. |
35 | */ | 91 | */ |
36 | 92 | ||
37 | #include <linux/module.h> | ||
38 | #include <linux/init.h> | 93 | #include <linux/init.h> |
39 | #include <linux/slab.h> | 94 | #include <linux/slab.h> |
40 | #include <linux/smp_lock.h> | 95 | #include <linux/smp_lock.h> |
41 | #include <linux/types.h> | 96 | #include <linux/types.h> |
42 | #include <linux/kernel.h> | 97 | #include <linux/kernel.h> |
43 | #include <linux/fs.h> | ||
44 | #include <linux/sound.h> | 98 | #include <linux/sound.h> |
45 | #include <linux/major.h> | 99 | #include <linux/major.h> |
46 | #include <linux/kmod.h> | 100 | #include <linux/kmod.h> |
47 | #include <linux/device.h> | ||
48 | 101 | ||
49 | #define SOUND_STEP 16 | 102 | #define SOUND_STEP 16 |
50 | 103 | ||
51 | |||
52 | struct sound_unit | 104 | struct sound_unit |
53 | { | 105 | { |
54 | int unit_minor; | 106 | int unit_minor; |
@@ -64,9 +116,6 @@ extern int msnd_classic_init(void); | |||
64 | extern int msnd_pinnacle_init(void); | 116 | extern int msnd_pinnacle_init(void); |
65 | #endif | 117 | #endif |
66 | 118 | ||
67 | struct class *sound_class; | ||
68 | EXPORT_SYMBOL(sound_class); | ||
69 | |||
70 | /* | 119 | /* |
71 | * Low level list operator. Scan the ordered list, find a hole and | 120 | * Low level list operator. Scan the ordered list, find a hole and |
72 | * join into it. Called with the lock asserted | 121 | * join into it. Called with the lock asserted |
@@ -523,31 +572,23 @@ int soundcore_open(struct inode *inode, struct file *file) | |||
523 | return -ENODEV; | 572 | return -ENODEV; |
524 | } | 573 | } |
525 | 574 | ||
526 | MODULE_DESCRIPTION("Core sound module"); | ||
527 | MODULE_AUTHOR("Alan Cox"); | ||
528 | MODULE_LICENSE("GPL"); | ||
529 | MODULE_ALIAS_CHARDEV_MAJOR(SOUND_MAJOR); | 575 | MODULE_ALIAS_CHARDEV_MAJOR(SOUND_MAJOR); |
530 | 576 | ||
531 | static void __exit cleanup_soundcore(void) | 577 | static void __exit cleanup_oss_soundcore(void) |
532 | { | 578 | { |
533 | /* We have nothing to really do here - we know the lists must be | 579 | /* We have nothing to really do here - we know the lists must be |
534 | empty */ | 580 | empty */ |
535 | unregister_chrdev(SOUND_MAJOR, "sound"); | 581 | unregister_chrdev(SOUND_MAJOR, "sound"); |
536 | class_destroy(sound_class); | ||
537 | } | 582 | } |
538 | 583 | ||
539 | static int __init init_soundcore(void) | 584 | static int __init init_oss_soundcore(void) |
540 | { | 585 | { |
541 | if (register_chrdev(SOUND_MAJOR, "sound", &soundcore_fops)==-1) { | 586 | if (register_chrdev(SOUND_MAJOR, "sound", &soundcore_fops)==-1) { |
542 | printk(KERN_ERR "soundcore: sound device already in use.\n"); | 587 | printk(KERN_ERR "soundcore: sound device already in use.\n"); |
543 | return -EBUSY; | 588 | return -EBUSY; |
544 | } | 589 | } |
545 | sound_class = class_create(THIS_MODULE, "sound"); | ||
546 | if (IS_ERR(sound_class)) | ||
547 | return PTR_ERR(sound_class); | ||
548 | 590 | ||
549 | return 0; | 591 | return 0; |
550 | } | 592 | } |
551 | 593 | ||
552 | module_init(init_soundcore); | 594 | #endif /* CONFIG_SOUND_OSS_CORE */ |
553 | module_exit(cleanup_soundcore); | ||