summaryrefslogtreecommitdiffstats
path: root/drivers/sound/v_midi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/sound/v_midi.c')
-rw-r--r--drivers/sound/v_midi.c57
1 files changed, 30 insertions, 27 deletions
diff --git a/drivers/sound/v_midi.c b/drivers/sound/v_midi.c
index 0cab16199..9c18ff5c8 100644
--- a/drivers/sound/v_midi.c
+++ b/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 vmidi_devc *v_devc[2] = { NULL, NULL};
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 @@ static int v_midi_out (int dev, unsigned char midi_byte)
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 @@ static int v_midi_end_read (int dev)
/* 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_memory
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 @@ void attach_v_midi (struct address_info *hw_config)
/* 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);