/* * open port for OSS sequencer */ static int snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure) { struct snd_emux *emu; struct snd_emux_port *p; struct snd_seq_port_callback callback; char tmpname[64]; emu = closure; if (snd_BUG_ON(!arg || !emu)) return -ENXIO; mutex_lock(&emu->register_mutex); if (!snd_emux_inc_count(emu)) { mutex_unlock(&emu->register_mutex); return -EFAULT; } memset(&callback, 0, sizeof(callback)); callback.owner = THIS_MODULE; callback.event_input = snd_emux_event_oss_input; sprintf(tmpname, "%s OSS Port", emu->name); p = snd_emux_create_port(emu, tmpname, 32, 1, &callback); if (p == NULL) { snd_printk(KERN_ERR "can't create port\n"); snd_emux_dec_count(emu); mutex_unlock(&emu->register_mutex); return -ENOMEM; } /* fill the argument data */ arg->private_data = p; arg->addr.client = p->chset.client; arg->addr.port = p->chset.port; p->oss_arg = arg; reset_port_mode(p, arg->seq_mode); snd_emux_reset_port(p); mutex_unlock(&emu->register_mutex); return 0; }
/* * Routine that is called upon a first use of a particular port */ static int snd_emux_use(void *private_data, snd_seq_port_subscribe_t *info) { snd_emux_port_t *p; snd_emux_t *emu; p = private_data; snd_assert(p != NULL, return -EINVAL); emu = p->emu; snd_assert(emu != NULL, return -EINVAL); down(&emu->register_mutex); snd_emux_init_port(p); snd_emux_inc_count(emu); up(&emu->register_mutex); return 0; }
/* * Routine that is called upon a first use of a particular port */ static int snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info) { struct snd_emux_port *p; struct snd_emux *emu; p = private_data; snd_assert(p != NULL, return -EINVAL); emu = p->emu; snd_assert(emu != NULL, return -EINVAL); mutex_lock(&emu->register_mutex); snd_emux_init_port(p); snd_emux_inc_count(emu); mutex_unlock(&emu->register_mutex); return 0; }
/* * Routine that is called upon a first use of a particular port */ static int snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info) { struct snd_emux_port *p; struct snd_emux *emu; p = private_data; if (snd_BUG_ON(!p)) return -EINVAL; emu = p->emu; if (snd_BUG_ON(!emu)) return -EINVAL; mutex_lock(&emu->register_mutex); snd_emux_init_port(p); snd_emux_inc_count(emu); mutex_unlock(&emu->register_mutex); return 0; }