X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fcore%2Fseq%2Foss%2Fseq_oss_init.c;h=ca5a2ed4d7c3a669315c6dc926813e28d38306d8;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=c8b199dc1a2bdf63f93aa92ddccbe3461a00ec79;hpb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;p=linux-2.6.git diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c index c8b199dc1..ca5a2ed4d 100644 --- a/sound/core/seq/oss/seq_oss_init.c +++ b/sound/core/seq/oss/seq_oss_init.c @@ -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,53 +65,44 @@ 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; - /* create ALSA client */ - memset(&callback, 0, sizeof(callback)); - - callback.private_data = NULL; - callback.allow_input = 1; - callback.allow_output = 1; + port = kmalloc(sizeof(*port), GFP_KERNEL); + if (!port) { + rc = -ENOMEM; + goto __error; + } - rc = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_OSS, &callback); + /* create ALSA client */ + rc = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_OSS, + "OSS sequencer"); if (rc < 0) - return rc; + 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); /* create annoucement receiver port */ - memset(&port, 0, sizeof(port)); - strcpy(port.name, "Receiver"); - port.addr.client = system_client; - port.capability = SNDRV_SEQ_PORT_CAP_WRITE; /* receive only */ - port.type = 0; + memset(port, 0, sizeof(*port)); + strcpy(port->name, "Receiver"); + port->addr.client = system_client; + port->capability = SNDRV_SEQ_PORT_CAP_WRITE; /* receive only */ + port->type = 0; memset(&port_callback, 0, sizeof(port_callback)); /* don't set port_callback.owner here. otherwise the module counter * is incremented and we can no longer release the module.. */ port_callback.event_input = receive_announce; - port.kernel = &port_callback; + port->kernel = &port_callback; - call_ctl(SNDRV_SEQ_IOCTL_CREATE_PORT, &port); - if ((system_port = port.addr.port) >= 0) { - snd_seq_port_subscribe_t subs; + call_ctl(SNDRV_SEQ_IOCTL_CREATE_PORT, port); + if ((system_port = port->addr.port) >= 0) { + struct snd_seq_port_subscribe subs; memset(&subs, 0, sizeof(subs)); subs.sender.client = SNDRV_SEQ_CLIENT_SYSTEM; @@ -120,9 +111,11 @@ snd_seq_oss_create_client(void) subs.dest.port = system_port; call_ctl(SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, &subs); } + rc = 0; - - return 0; + __error: + kfree(port); + return rc; } @@ -130,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 */ @@ -181,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 = snd_kcalloc(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; } @@ -211,7 +204,7 @@ snd_seq_oss_open(struct file *file, int level) snd_seq_oss_midi_setup(dp); if (dp->synth_opened == 0 && dp->max_mididev == 0) { - snd_printk(KERN_ERR "no device found\n"); + /* snd_printk(KERN_ERR "no device found\n"); */ rc = -ENODEV; goto _error; } @@ -313,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; @@ -348,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; @@ -361,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)); @@ -382,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) @@ -402,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); @@ -421,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; @@ -450,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; @@ -467,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; @@ -491,14 +484,35 @@ snd_seq_oss_reset(seq_oss_devinfo_t *dp) snd_seq_oss_timer_stop(dp->timer); } + +#ifdef CONFIG_PROC_FS +/* + * misc. functions for proc interface + */ +char * +enabled_str(int bool) +{ + return bool ? "enabled" : "disabled"; +} + +static char * +filemode_str(int val) +{ + static char *str[] = { + "none", "read", "write", "read/write", + }; + return str[val & SNDRV_SEQ_OSS_FILE_ACMODE]; +} + + /* * 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); @@ -522,23 +536,4 @@ snd_seq_oss_system_info_read(snd_info_buffer_t *buf) snd_seq_oss_readq_info_read(dp->readq, buf); } } - -/* - * misc. functions for proc interface - */ -char * -enabled_str(int bool) -{ - return bool ? "enabled" : "disabled"; -} - -char * -filemode_str(int val) -{ - static char *str[] = { - "none", "read", "write", "read/write", - }; - return str[val & SNDRV_SEQ_OSS_FILE_ACMODE]; -} - - +#endif /* CONFIG_PROC_FS */