Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / sound / core / seq / oss / seq_oss_init.c
index bac4b4f..ca5a2ed 100644 (file)
@@ -41,17 +41,17 @@ static int system_client = -1; /* ALSA sequencer client number */
 static int system_port = -1;
 
 static int num_clients;
-static seq_oss_devinfo_t *client_table[SNDRV_SEQ_OSS_MAX_CLIENTS];
+static struct seq_oss_devinfo *client_table[SNDRV_SEQ_OSS_MAX_CLIENTS];
 
 
 /*
  * prototypes
  */
-static int receive_announce(snd_seq_event_t *ev, int direct, void *private, int atomic, int hop);
+static int receive_announce(struct snd_seq_event *ev, int direct, void *private, int atomic, int hop);
 static int translate_mode(struct file *file);
-static int create_port(seq_oss_devinfo_t *dp);
-static int delete_port(seq_oss_devinfo_t *dp);
-static int alloc_seq_queue(seq_oss_devinfo_t *dp);
+static int create_port(struct seq_oss_devinfo *dp);
+static int delete_port(struct seq_oss_devinfo *dp);
+static int alloc_seq_queue(struct seq_oss_devinfo *dp);
 static int delete_seq_queue(int queue);
 static void free_devinfo(void *private);
 
@@ -65,40 +65,24 @@ int __init
 snd_seq_oss_create_client(void)
 {
        int rc;
-       snd_seq_client_callback_t callback;
-       snd_seq_client_info_t *info;
-       snd_seq_port_info_t *port;
-       snd_seq_port_callback_t port_callback;
+       struct snd_seq_port_info *port;
+       struct snd_seq_port_callback port_callback;
 
-       info = kmalloc(sizeof(*info), GFP_KERNEL);
        port = kmalloc(sizeof(*port), GFP_KERNEL);
-       if (!info || !port) {
+       if (!port) {
                rc = -ENOMEM;
                goto __error;
        }
 
        /* create ALSA client */
-       memset(&callback, 0, sizeof(callback));
-
-       callback.private_data = NULL;
-       callback.allow_input = 1;
-       callback.allow_output = 1;
-
-       rc = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_OSS, &callback);
+       rc = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_OSS,
+                                         "OSS sequencer");
        if (rc < 0)
                goto __error;
 
        system_client = rc;
        debug_printk(("new client = %d\n", rc));
 
-       /* set client information */
-       memset(info, 0, sizeof(*info));
-       info->client = system_client;
-       info->type = KERNEL_CLIENT;
-       strcpy(info->name, "OSS sequencer");
-
-       rc = call_ctl(SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, info);
-
        /* look up midi devices */
        snd_seq_oss_midi_lookup_ports(system_client);
 
@@ -118,7 +102,7 @@ snd_seq_oss_create_client(void)
        
        call_ctl(SNDRV_SEQ_IOCTL_CREATE_PORT, port);
        if ((system_port = port->addr.port) >= 0) {
-               snd_seq_port_subscribe_t subs;
+               struct snd_seq_port_subscribe subs;
 
                memset(&subs, 0, sizeof(subs));
                subs.sender.client = SNDRV_SEQ_CLIENT_SYSTEM;
@@ -131,7 +115,6 @@ snd_seq_oss_create_client(void)
 
  __error:
        kfree(port);
-       kfree(info);
        return rc;
 }
 
@@ -140,9 +123,9 @@ snd_seq_oss_create_client(void)
  * receive annoucement from system port, and check the midi device
  */
 static int
-receive_announce(snd_seq_event_t *ev, int direct, void *private, int atomic, int hop)
+receive_announce(struct snd_seq_event *ev, int direct, void *private, int atomic, int hop)
 {
-       snd_seq_port_info_t pinfo;
+       struct snd_seq_port_info pinfo;
 
        if (atomic)
                return 0; /* it must not happen */
@@ -191,9 +174,9 @@ int
 snd_seq_oss_open(struct file *file, int level)
 {
        int i, rc;
-       seq_oss_devinfo_t *dp;
+       struct seq_oss_devinfo *dp;
 
-       if ((dp = kcalloc(1, sizeof(*dp), GFP_KERNEL)) == NULL) {
+       if ((dp = kzalloc(sizeof(*dp), GFP_KERNEL)) == NULL) {
                snd_printk(KERN_ERR "can't malloc device info\n");
                return -ENOMEM;
        }
@@ -323,11 +306,11 @@ translate_mode(struct file *file)
  * create sequencer port
  */
 static int
-create_port(seq_oss_devinfo_t *dp)
+create_port(struct seq_oss_devinfo *dp)
 {
        int rc;
-       snd_seq_port_info_t port;
-       snd_seq_port_callback_t callback;
+       struct snd_seq_port_info port;
+       struct snd_seq_port_callback callback;
 
        memset(&port, 0, sizeof(port));
        port.addr.client = dp->cseq;
@@ -358,7 +341,7 @@ create_port(seq_oss_devinfo_t *dp)
  * delete ALSA port
  */
 static int
-delete_port(seq_oss_devinfo_t *dp)
+delete_port(struct seq_oss_devinfo *dp)
 {
        if (dp->port < 0)
                return 0;
@@ -371,9 +354,9 @@ delete_port(seq_oss_devinfo_t *dp)
  * allocate a queue
  */
 static int
-alloc_seq_queue(seq_oss_devinfo_t *dp)
+alloc_seq_queue(struct seq_oss_devinfo *dp)
 {
-       snd_seq_queue_info_t qinfo;
+       struct snd_seq_queue_info qinfo;
        int rc;
 
        memset(&qinfo, 0, sizeof(qinfo));
@@ -392,7 +375,7 @@ alloc_seq_queue(seq_oss_devinfo_t *dp)
 static int
 delete_seq_queue(int queue)
 {
-       snd_seq_queue_info_t qinfo;
+       struct snd_seq_queue_info qinfo;
        int rc;
 
        if (queue < 0)
@@ -412,7 +395,7 @@ delete_seq_queue(int queue)
 static void
 free_devinfo(void *private)
 {
-       seq_oss_devinfo_t *dp = (seq_oss_devinfo_t *)private;
+       struct seq_oss_devinfo *dp = (struct seq_oss_devinfo *)private;
 
        if (dp->timer)
                snd_seq_oss_timer_delete(dp->timer);
@@ -431,7 +414,7 @@ free_devinfo(void *private)
  * close sequencer device
  */
 void
-snd_seq_oss_release(seq_oss_devinfo_t *dp)
+snd_seq_oss_release(struct seq_oss_devinfo *dp)
 {
        int queue;
 
@@ -460,7 +443,7 @@ snd_seq_oss_release(seq_oss_devinfo_t *dp)
  * Wait until the queue is empty (if we don't have nonblock)
  */
 void
-snd_seq_oss_drain_write(seq_oss_devinfo_t *dp)
+snd_seq_oss_drain_write(struct seq_oss_devinfo *dp)
 {
        if (! dp->timer->running)
                return;
@@ -477,7 +460,7 @@ snd_seq_oss_drain_write(seq_oss_devinfo_t *dp)
  * reset sequencer devices
  */
 void
-snd_seq_oss_reset(seq_oss_devinfo_t *dp)
+snd_seq_oss_reset(struct seq_oss_devinfo *dp)
 {
        int i;
 
@@ -502,6 +485,7 @@ snd_seq_oss_reset(seq_oss_devinfo_t *dp)
 }
 
 
+#ifdef CONFIG_PROC_FS
 /*
  * misc. functions for proc interface
  */
@@ -525,10 +509,10 @@ filemode_str(int val)
  * proc interface
  */
 void
-snd_seq_oss_system_info_read(snd_info_buffer_t *buf)
+snd_seq_oss_system_info_read(struct snd_info_buffer *buf)
 {
        int i;
-       seq_oss_devinfo_t *dp;
+       struct seq_oss_devinfo *dp;
 
        snd_iprintf(buf, "ALSA client number %d\n", system_client);
        snd_iprintf(buf, "ALSA receiver port %d\n", system_port);
@@ -552,4 +536,4 @@ snd_seq_oss_system_info_read(snd_info_buffer_t *buf)
                        snd_seq_oss_readq_info_read(dp->readq, buf);
        }
 }
-
+#endif /* CONFIG_PROC_FS */