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);
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;
subs.dest.port = system_port;
call_ctl(SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, &subs);
}
+ rc = 0;
-
- return 0;
+ __error:
+ kfree(port);
+ return rc;
}
* 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 */
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;
}
* 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;
* 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;
* 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));
static int
delete_seq_queue(int queue)
{
- snd_seq_queue_info_t qinfo;
+ struct snd_seq_queue_info qinfo;
int rc;
if (queue < 0)
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);
* close sequencer device
*/
void
-snd_seq_oss_release(seq_oss_devinfo_t *dp)
+snd_seq_oss_release(struct seq_oss_devinfo *dp)
{
int queue;
* 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;
* reset sequencer devices
*/
void
-snd_seq_oss_reset(seq_oss_devinfo_t *dp)
+snd_seq_oss_reset(struct seq_oss_devinfo *dp)
{
int i;
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);
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 */