patch-2.3.50 linux/drivers/sound/opl3sa.c
Next file: linux/drivers/sound/opl3sa2.c
Previous file: linux/drivers/sound/opl3_hw.h
Back to the patch index
Back to the overall index
- Lines: 196
- Date:
Tue Mar 7 13:40:24 2000
- Orig file:
v2.3.49/linux/drivers/sound/opl3sa.c
- Orig date:
Thu Mar 2 14:36:23 2000
diff -u --recursive --new-file v2.3.49/linux/drivers/sound/opl3sa.c linux/drivers/sound/opl3sa.c
@@ -13,21 +13,26 @@
*
* Changes:
* Alan Cox Modularisation
+ * Christoph Hellwig Adapted to module_init/module_exit
*
* FIXME:
* Check for install of mpu etc is wrong, should check result of the mss stuff
*/
-
+
+#include <linux/init.h>
#include <linux/module.h>
#undef SB_OK
#include "sound_config.h"
#include "soundmodule.h"
+
+#include "ad1848.h"
+#include "mpu401.h"
+
#ifdef SB_OK
#include "sb.h"
static int sb_initialized = 0;
-
#endif
static int kilroy_was_here = 0; /* Don't detect twice */
@@ -62,7 +67,7 @@
restore_flags(flags);
}
-static int opl3sa_detect(void)
+static int __init opl3sa_detect(void)
{
int tmp;
@@ -102,7 +107,7 @@
* OPL3-SA
*/
-int probe_opl3sa_wss(struct address_info *hw_config)
+static int __init probe_opl3sa_wss(struct address_info *hw_config)
{
int ret;
unsigned char tmp = 0x24; /* WSS enable */
@@ -157,7 +162,7 @@
return ret;
}
-void attach_opl3sa_wss(struct address_info *hw_config)
+static void __init attach_opl3sa_wss(struct address_info *hw_config)
{
int nm = num_mixers;
@@ -172,13 +177,13 @@
}
-void attach_opl3sa_mpu(struct address_info *hw_config)
+static void __init attach_opl3sa_mpu(struct address_info *hw_config)
{
hw_config->name = "OPL3-SA (MPU401)";
attach_uart401(hw_config);
}
-int probe_opl3sa_mpu(struct address_info *hw_config)
+static int __init probe_opl3sa_mpu(struct address_info *hw_config)
{
unsigned char conf;
static signed char irq_bits[] = {
@@ -236,7 +241,7 @@
return probe_uart401(hw_config);
}
-void unload_opl3sa_wss(struct address_info *hw_config)
+static void __exit unload_opl3sa_wss(struct address_info *hw_config)
{
int dma2 = hw_config->dma2;
@@ -254,26 +259,29 @@
sound_unload_audiodev(hw_config->slots[0]);
}
-void unload_opl3sa_mpu(struct address_info *hw_config)
+static inline void __exit unload_opl3sa_mpu(struct address_info *hw_config)
{
unload_uart401(hw_config);
}
#ifdef SB_OK
-void unload_opl3sa_sb(struct address_info *hw_config)
+static inline void __exit unload_opl3sa_sb(struct address_info *hw_config)
{
sb_dsp_unload(hw_config);
}
#endif
-#ifdef MODULE
-int io = -1;
-int irq = -1;
-int dma = -1;
-int dma2 = -1;
+static int found_mpu;
+
+static struct address_info cfg;
+static struct address_info cfg_mpu;
-int mpu_io = -1;
-int mpu_irq = -1;
+static int __initdata io = -1;
+static int __initdata irq = -1;
+static int __initdata dma = -1;
+static int __initdata dma2 = -1;
+static int __initdata mpu_io = -1;
+static int __initdata mpu_irq = -1;
MODULE_PARM(io,"i");
MODULE_PARM(irq,"i");
@@ -282,43 +290,61 @@
MODULE_PARM(mpu_io,"i");
MODULE_PARM(mpu_irq,"i");
-struct address_info cfg;
-struct address_info mpu_cfg;
-static int found_mpu;
-
-int init_module(void)
+static int __init init_opl3sa(void)
{
- if (io == -1 || irq == -1 || dma == -1)
- {
+ if (io == -1 || irq == -1 || dma == -1) {
printk(KERN_ERR "opl3sa: dma, irq and io must be set.\n");
return -EINVAL;
}
+
cfg.io_base = io;
cfg.irq = irq;
cfg.dma = dma;
cfg.dma2 = dma2;
- mpu_cfg.io_base = mpu_io;
- mpu_cfg.irq = mpu_irq;
+ cfg_mpu.io_base = mpu_io;
+ cfg_mpu.irq = mpu_irq;
if (probe_opl3sa_wss(&cfg) == 0)
return -ENODEV;
- found_mpu=probe_opl3sa_mpu(&mpu_cfg);
+ found_mpu=probe_opl3sa_mpu(&cfg_mpu);
attach_opl3sa_wss(&cfg);
if(found_mpu)
- attach_opl3sa_mpu(&mpu_cfg);
+ attach_opl3sa_mpu(&cfg_mpu);
SOUND_LOCK;
return 0;
}
-void cleanup_module(void)
+static void __exit cleanup_opl3sa(void)
{
if(found_mpu)
- unload_opl3sa_mpu(&mpu_cfg);
+ unload_opl3sa_mpu(&cfg_mpu);
unload_opl3sa_wss(&cfg);
SOUND_LOCK_END;
}
-#endif /* MODULE */
+module_init(init_opl3sa);
+module_exit(cleanup_opl3sa);
+
+#ifndef MODULE
+static int __init setup_opl3sa(char *str)
+{
+ /* io, irq, dma, dma2, mpu_io, mpu_irq */
+ int ints[7];
+
+ str = get_options(str, ARRAY_SIZE(ints), ints);
+
+ io = ints[1];
+ irq = ints[2];
+ dma = ints[3];
+ dma2 = ints[4];
+ mpu_io = ints[5];
+ mpu_irq = ints[6];
+
+ return 1;
+}
+
+__setup("opl3sa=", setup_opl3sa);
+#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)