patch-2.3.50 linux/drivers/sound/v_midi.c
Next file: linux/drivers/sound/via82cxxx_audio.c
Previous file: linux/drivers/sound/uart6850.c
Back to the patch index
Back to the overall index
- Lines: 111
- Date:
Tue Mar 7 13:40:24 2000
- Orig file:
v2.3.49/linux/drivers/sound/v_midi.c
- Orig date:
Thu Mar 2 14:36:23 2000
diff -u --recursive --new-file v2.3.49/linux/drivers/sound/v_midi.c linux/drivers/sound/v_midi.c
@@ -13,11 +13,13 @@
*
* Changes
* Alan Cox Modularisation, changed memory allocations
+ * Christoph Hellwig Adapted to module_init/module_exit
*
* Status
* Untested
*/
+#include <linux/init.h>
#include <linux/module.h>
#include "sound_config.h"
@@ -29,28 +31,6 @@
static int midi1,midi2;
static void *midi_mem = NULL;
-#ifdef MODULE
-
-static struct address_info config; /* dummy */
-
-int init_module(void)
-{
- printk("MIDI Loopback device driver\n");
- if (!probe_v_midi(&config))
- return -ENODEV;
- attach_v_midi(&config);
- SOUND_LOCK;
- return 0;
-}
-
-void cleanup_module(void)
-{
- unload_v_midi(&config);
- SOUND_LOCK_END;
-}
-
-#endif /* MODULE */
-
/*
* The DSP channel can be used either for input or output. Variable
* 'sb_irq_mode' will be set when the program calls read or write first time
@@ -126,7 +106,7 @@
return 1;
}
-static int v_midi_start_read (int dev)
+static inline int v_midi_start_read (int dev)
{
return 0;
}
@@ -143,7 +123,7 @@
/* why -EPERM and not -EINVAL?? */
-static int v_midi_ioctl (int dev, unsigned cmd, caddr_t arg)
+static inline int v_midi_ioctl (int dev, unsigned cmd, caddr_t arg)
{
return -EPERM;
}
@@ -201,7 +181,7 @@
struct vmidi_devc v_ops[2];
};
-void attach_v_midi (struct address_info *hw_config)
+static void __init attach_v_midi (struct address_info *hw_config)
{
struct vmidi_memory *m;
/* printk("Attaching v_midi device.....\n"); */
@@ -282,15 +262,38 @@
/* printk("Attached v_midi device\n"); */
}
-int probe_v_midi(struct address_info *hw_config)
+static inline int __init probe_v_midi(struct address_info *hw_config)
{
return(1); /* always OK */
}
-void unload_v_midi(struct address_info *hw_config)
+static void __exit unload_v_midi(struct address_info *hw_config)
{
sound_unload_mididev(midi1);
sound_unload_mididev(midi2);
kfree(midi_mem);
}
+
+static struct address_info cfg; /* dummy */
+
+static int __init init_vmidi(void)
+{
+ printk("MIDI Loopback device driver\n");
+ if (!probe_v_midi(&cfg))
+ return -ENODEV;
+ attach_v_midi(&cfg);
+
+ SOUND_LOCK;
+
+ return 0;
+}
+
+static void __exit cleanup_vmidi(void)
+{
+ unload_v_midi(&cfg);
+ SOUND_LOCK_END;
+}
+
+module_init(init_vmidi);
+module_exit(cleanup_vmidi);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)