patch-2.3.50 linux/drivers/sound/adlib_card.c
Next file: linux/drivers/sound/cs4232.c
Previous file: linux/drivers/sound/ad1848.h
Back to the patch index
Back to the overall index
- Lines: 92
- Date:
Tue Mar 7 13:40:24 2000
- Orig file:
v2.3.49/linux/drivers/sound/adlib_card.c
- Orig date:
Sat Feb 26 22:31:49 2000
diff -u --recursive --new-file v2.3.49/linux/drivers/sound/adlib_card.c linux/drivers/sound/adlib_card.c
@@ -11,47 +11,42 @@
*/
#include <linux/module.h>
+#include <linux/init.h>
+
#include "sound_config.h"
#include "soundmodule.h"
-void attach_adlib_card(struct address_info *hw_config)
+#include "opl3.h"
+
+static void __init attach_adlib_card(struct address_info *hw_config)
{
hw_config->slots[0] = opl3_init(hw_config->io_base, hw_config->osp);
request_region(hw_config->io_base, 4, "OPL3/OPL2");
}
-int probe_adlib(struct address_info *hw_config)
+static int __init probe_adlib(struct address_info *hw_config)
{
- if (check_region(hw_config->io_base, 4))
- {
+ if (check_region(hw_config->io_base, 4)) {
DDB(printk("opl3.c: I/O port %x already in use\n", hw_config->io_base));
return 0;
}
return opl3_detect(hw_config->io_base, hw_config->osp);
}
-void unload_adlib(struct address_info *hw_config)
-{
- release_region(hw_config->io_base, 4);
- sound_unload_synthdev(hw_config->slots[0]);
-}
+static struct address_info cfg;
-#ifdef MODULE
+static int __initdata io = -1;
-int io = -1;
MODULE_PARM(io, "i");
-EXPORT_NO_SYMBOLS;
-
-struct address_info cfg;
-
-int init_module(void)
+static int __init init_adlib(void)
{
- if (io == -1) {
+ cfg.io_base = io;
+
+ if (cfg.io_base == -1) {
printk(KERN_ERR "adlib: must specify I/O address.\n");
return -EINVAL;
}
- cfg.io_base = io;
if (probe_adlib(&cfg) == 0)
return -ENODEV;
attach_adlib_card(&cfg);
@@ -59,10 +54,27 @@
return 0;
}
-void cleanup_module(void)
+static void __exit cleanup_adlib(void)
{
- unload_adlib(&cfg);
+ release_region(cfg.io_base, 4);
+ sound_unload_synthdev(cfg.slots[0]);
+
SOUND_LOCK_END;
}
-#endif /* MODULE */
+module_init(init_adlib);
+module_exit(cleanup_adlib);
+
+#ifndef MODULE
+static int __init setup_adlib(char *str)
+{
+ /* io */
+ int ints[2];
+ str = get_options(str, ARRAY_SIZE(ints), ints);
+
+ io = ints[1];
+
+ return 1;
+}
+__setup("adlib=", setup_adlib);
+#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)