summaryrefslogtreecommitdiffstats
path: root/drivers/sound/soundcard.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-10-05 01:18:40 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-10-05 01:18:40 +0000
commit012bb3e61e5eced6c610f9e036372bf0c8def2d1 (patch)
tree87efc733f9b164e8c85c0336f92c8fb7eff6d183 /drivers/sound/soundcard.c
parent625a1589d3d6464b5d90b8a0918789e3afffd220 (diff)
Merge with Linux 2.4.0-test9. Please check DECstation, I had a number
of rejects to fixup while integrating Linus patches. I also found that this kernel will only boot SMP on Origin; the UP kernel freeze soon after bootup with SCSI timeout messages. I commit this anyway since I found that the last CVS versions had the same problem.
Diffstat (limited to 'drivers/sound/soundcard.c')
-rw-r--r--drivers/sound/soundcard.c56
1 files changed, 19 insertions, 37 deletions
diff --git a/drivers/sound/soundcard.c b/drivers/sound/soundcard.c
index fc715db83..87ec7f181 100644
--- a/drivers/sound/soundcard.c
+++ b/drivers/sound/soundcard.c
@@ -25,6 +25,7 @@
#include <linux/config.h>
#include "sound_config.h"
+#include <linux/init.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/signal.h>
@@ -51,8 +52,6 @@
#define valid_dma(n) ((n) >= 0 && (n) < MAX_DMA_CHANNELS && (n) != 4)
#endif
-static int chrdev_registered = 0;
-
/*
* Table for permanently allocated memory (used when unloading the module)
*/
@@ -267,6 +266,7 @@ static int sound_release(struct inode *inode, struct file *file)
DEB(printk("sound_release(dev=%d)\n", dev));
switch (dev & 0x0f) {
case SND_DEV_CTL:
+ dev >>= 4;
if (mixer_devs[dev]->owner)
__MOD_DEC_USE_COUNT (mixer_devs[dev]->owner);
break;
@@ -582,34 +582,6 @@ static void soundcard_register_devfs (int do_register)
}
}
-#ifdef MODULE
-static void
-#else
-void
-#endif
-soundcard_init(void)
-{
- /* drag in sound_syms.o */
- {
- extern char sound_syms_symbol;
- sound_syms_symbol = 0;
- }
-
-#ifndef MODULE
- create_special_devices();
- chrdev_registered = 1;
-#endif
-
- soundcard_register_devfs(1); /* register after we know # of devices */
-}
-
-#ifdef MODULE
-
-static void destroy_special_devices(void)
-{
- unregister_sound_special(1);
- unregister_sound_special(8);
-}
static int dmabuf = 0;
static int dmabug = 0;
@@ -617,14 +589,21 @@ static int dmabug = 0;
MODULE_PARM(dmabuf, "i");
MODULE_PARM(dmabug, "i");
-int init_module(void)
+static int __init oss_init(void)
{
int err;
+
+ /* drag in sound_syms.o */
+ {
+ extern char sound_syms_symbol;
+ sound_syms_symbol = 0;
+ }
#ifdef CONFIG_PCI
if(dmabug)
isa_dma_bridge_buggy = dmabug;
#endif
+
err = create_special_devices();
if (err) {
printk(KERN_ERR "sound: driver already loaded/included in kernel\n");
@@ -634,8 +613,7 @@ int init_module(void)
/* Protecting the innocent */
sound_dmap_flag = (dmabuf > 0 ? 1 : 0);
- chrdev_registered = 1;
- soundcard_init();
+ soundcard_register_devfs(1);
if (sound_nblocks >= 1024)
printk(KERN_ERR "Sound warning: Deallocation table was too small.\n");
@@ -643,7 +621,7 @@ int init_module(void)
return 0;
}
-void cleanup_module(void)
+static void __exit oss_cleanup(void)
{
int i;
@@ -651,8 +629,9 @@ void cleanup_module(void)
return;
soundcard_register_devfs (0);
- if (chrdev_registered)
- destroy_special_devices();
+
+ unregister_sound_special(1);
+ unregister_sound_special(8);
sound_stop_timer();
@@ -668,7 +647,10 @@ void cleanup_module(void)
vfree(sound_mem_blocks[i]);
}
-#endif
+
+module_init(oss_init);
+module_exit(oss_cleanup);
+
int sound_alloc_dma(int chn, char *deviceID)
{