vserver 1.9.5.x5
[linux-2.6.git] / sound / core / seq / seq_dummy.c
index e05095a..6380acf 100644 (file)
@@ -21,6 +21,7 @@
 #include <sound/driver.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include "seq_clientmgr.h"
 #include <sound/initval.h>
 MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
 MODULE_DESCRIPTION("ALSA sequencer MIDI-through client");
 MODULE_LICENSE("GPL");
-MODULE_CLASSES("{sound}");
-MODULE_SUPPORTED_DEVICE("sound");
-MODULE_PARM(ports, "i");
+
+static int ports = 1;
+static int duplex = 0;
+
+module_param(ports, int, 0444);
 MODULE_PARM_DESC(ports, "number of ports to be created");
-MODULE_PARM(duplex, "i");
+module_param(duplex, bool, 0444);
 MODULE_PARM_DESC(duplex, "create DUPLEX ports");
-int ports = 1;
-int duplex = 0;
 
 typedef struct snd_seq_dummy_port {
        int client;
@@ -92,7 +93,7 @@ dummy_unuse(void *private_data, snd_seq_port_subscribe_t *info)
        int i;
        snd_seq_event_t ev;
 
-       p = snd_magic_cast(snd_seq_dummy_port_t, private_data, return -EINVAL);
+       p = private_data;
        memset(&ev, 0, sizeof(ev));
        if (p->duplex)
                ev.source.port = p->connect;
@@ -119,18 +120,11 @@ dummy_input(snd_seq_event_t *ev, int direct, void *private_data, int atomic, int
        snd_seq_dummy_port_t *p;
        snd_seq_event_t tmpev;
 
-       p = snd_magic_cast(snd_seq_dummy_port_t, private_data, return -EINVAL);
+       p = private_data;
        if (ev->source.client == SNDRV_SEQ_CLIENT_SYSTEM ||
            ev->type == SNDRV_SEQ_EVENT_KERNEL_ERROR)
                return 0; /* ignore system messages */
-       /* save the original sender */
-       tmpev.type = SNDRV_SEQ_EVENT_KERNEL_QUOTE;
-       tmpev.flags = (ev->flags & ~SNDRV_SEQ_EVENT_LENGTH_MASK)
-               | SNDRV_SEQ_EVENT_LENGTH_FIXED;
-       tmpev.tag = ev->tag;
-       tmpev.time = ev->time;
-       tmpev.data.quote.origin = ev->source;
-       tmpev.data.quote.event = ev;
+       tmpev = *ev;
        if (p->duplex)
                tmpev.source.port = p->connect;
        else
@@ -147,8 +141,8 @@ dummy_free(void *private_data)
 {
        snd_seq_dummy_port_t *p;
 
-       p = snd_magic_cast(snd_seq_dummy_port_t, private_data, return);
-       snd_magic_kfree(p);
+       p = private_data;
+       kfree(p);
 }
 
 /*
@@ -161,7 +155,7 @@ create_port(int idx, int type)
        snd_seq_port_callback_t pcb;
        snd_seq_dummy_port_t *rec;
 
-       if ((rec = snd_magic_kcalloc(snd_seq_dummy_port_t, 0, GFP_KERNEL)) == NULL)
+       if ((rec = kcalloc(1, sizeof(*rec), GFP_KERNEL)) == NULL)
                return NULL;
 
        rec->client = my_client;
@@ -187,7 +181,7 @@ create_port(int idx, int type)
        pcb.private_data = rec;
        pinfo.kernel = &pcb;
        if (snd_seq_kernel_client_ctl(my_client, SNDRV_SEQ_IOCTL_CREATE_PORT, &pinfo) < 0) {
-               snd_magic_kfree(rec);
+               kfree(rec);
                return NULL;
        }
        rec->port = pinfo.addr.port;
@@ -262,7 +256,11 @@ delete_client(void)
 
 static int __init alsa_seq_dummy_init(void)
 {
-       return register_client();
+       int err;
+       snd_seq_autoload_lock();
+       err = register_client();
+       snd_seq_autoload_unlock();
+       return err;
 }
 
 static void __exit alsa_seq_dummy_exit(void)