]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/synth/emux/emux_oss.c
ALSA: Kill snd_assert() in other places
[linux-2.6-omap-h63xx.git] / sound / synth / emux / emux_oss.c
index 5272f4ac8afd044a75df967730dd5247fc5f9a17..5c47b6c09264e26414276e1663a4723cff005650 100644 (file)
@@ -22,7 +22,6 @@
  *                             midi emulation.
  */
 
-#include <sound/driver.h>
 
 #ifdef CONFIG_SND_SEQUENCER_OSS
 
 #include "emux_voice.h"
 #include <sound/asoundef.h>
 
-static int snd_emux_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure);
-static int snd_emux_close_seq_oss(snd_seq_oss_arg_t *arg);
-static int snd_emux_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long ioarg);
-static int snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, const char __user *buf, int offs, int count);
-static int snd_emux_reset_seq_oss(snd_seq_oss_arg_t *arg);
-static int snd_emux_event_oss_input(snd_seq_event_t *ev, int direct, void *private, int atomic, int hop);
-static void reset_port_mode(snd_emux_port_t *port, int midi_mode);
-static void emuspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd, unsigned char *event, int atomic, int hop);
-static void gusspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd, unsigned char *event, int atomic, int hop);
-static void fake_event(snd_emux_t *emu, snd_emux_port_t *port, int ch, int param, int val, int atomic, int hop);
+static int snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure);
+static int snd_emux_close_seq_oss(struct snd_seq_oss_arg *arg);
+static int snd_emux_ioctl_seq_oss(struct snd_seq_oss_arg *arg, unsigned int cmd,
+                                 unsigned long ioarg);
+static int snd_emux_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format,
+                                      const char __user *buf, int offs, int count);
+static int snd_emux_reset_seq_oss(struct snd_seq_oss_arg *arg);
+static int snd_emux_event_oss_input(struct snd_seq_event *ev, int direct,
+                                   void *private, int atomic, int hop);
+static void reset_port_mode(struct snd_emux_port *port, int midi_mode);
+static void emuspec_control(struct snd_emux *emu, struct snd_emux_port *port,
+                           int cmd, unsigned char *event, int atomic, int hop);
+static void gusspec_control(struct snd_emux *emu, struct snd_emux_port *port,
+                           int cmd, unsigned char *event, int atomic, int hop);
+static void fake_event(struct snd_emux *emu, struct snd_emux_port *port,
+                      int ch, int param, int val, int atomic, int hop);
 
 /* operators */
-static snd_seq_oss_callback_t oss_callback = {
+static struct snd_seq_oss_callback oss_callback = {
        .owner = THIS_MODULE,
        .open = snd_emux_open_seq_oss,
        .close = snd_emux_close_seq_oss,
@@ -58,13 +63,13 @@ static snd_seq_oss_callback_t oss_callback = {
  */
 
 void
-snd_emux_init_seq_oss(snd_emux_t *emu)
+snd_emux_init_seq_oss(struct snd_emux *emu)
 {
-       snd_seq_oss_reg_t *arg;
-       snd_seq_device_t *dev;
+       struct snd_seq_oss_reg *arg;
+       struct snd_seq_device *dev;
 
        if (snd_seq_device_new(emu->card, 0, SNDRV_SEQ_DEV_ID_OSS,
-                              sizeof(snd_seq_oss_reg_t), &dev) < 0)
+                              sizeof(struct snd_seq_oss_reg), &dev) < 0)
                return;
 
        emu->oss_synth = dev;
@@ -85,7 +90,7 @@ snd_emux_init_seq_oss(snd_emux_t *emu)
  * unregister
  */
 void
-snd_emux_detach_seq_oss(snd_emux_t *emu)
+snd_emux_detach_seq_oss(struct snd_emux *emu)
 {
        if (emu->oss_synth) {
                snd_device_free(emu->card, emu->oss_synth);
@@ -101,20 +106,21 @@ snd_emux_detach_seq_oss(snd_emux_t *emu)
  * open port for OSS sequencer
  */
 static int
-snd_emux_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure)
+snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure)
 {
-       snd_emux_t *emu;
-       snd_emux_port_t *p;
-       snd_seq_port_callback_t callback;
+       struct snd_emux *emu;
+       struct snd_emux_port *p;
+       struct snd_seq_port_callback callback;
        char tmpname[64];
 
        emu = closure;
-       snd_assert(arg != NULL && emu != NULL, return -ENXIO);
+       if (snd_BUG_ON(!arg || !emu))
+               return -ENXIO;
 
-       down(&emu->register_mutex);
+       mutex_lock(&emu->register_mutex);
 
        if (!snd_emux_inc_count(emu)) {
-               up(&emu->register_mutex);
+               mutex_unlock(&emu->register_mutex);
                return -EFAULT;
        }
 
@@ -128,7 +134,7 @@ snd_emux_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure)
        if (p == NULL) {
                snd_printk("can't create port\n");
                snd_emux_dec_count(emu);
-               up(&emu->register_mutex);
+               mutex_unlock(&emu->register_mutex);
                return -ENOMEM;
        }
 
@@ -142,7 +148,7 @@ snd_emux_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure)
 
        snd_emux_reset_port(p);
 
-       up(&emu->register_mutex);
+       mutex_unlock(&emu->register_mutex);
        return 0;
 }
 
@@ -153,7 +159,7 @@ snd_emux_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure)
  * reset port mode
  */
 static void
-reset_port_mode(snd_emux_port_t *port, int midi_mode)
+reset_port_mode(struct snd_emux_port *port, int midi_mode)
 {
        if (midi_mode) {
                port->port_mode = SNDRV_EMUX_PORT_MODE_OSS_MIDI;
@@ -173,25 +179,28 @@ reset_port_mode(snd_emux_port_t *port, int midi_mode)
  * close port
  */
 static int
-snd_emux_close_seq_oss(snd_seq_oss_arg_t *arg)
+snd_emux_close_seq_oss(struct snd_seq_oss_arg *arg)
 {
-       snd_emux_t *emu;
-       snd_emux_port_t *p;
+       struct snd_emux *emu;
+       struct snd_emux_port *p;
 
-       snd_assert(arg != NULL, return -ENXIO);
+       if (snd_BUG_ON(!arg))
+               return -ENXIO;
        p = arg->private_data;
-       snd_assert(p != NULL, return -ENXIO);
+       if (snd_BUG_ON(!p))
+               return -ENXIO;
 
        emu = p->emu;
-       snd_assert(emu != NULL, return -ENXIO);
+       if (snd_BUG_ON(!emu))
+               return -ENXIO;
 
-       down(&emu->register_mutex);
+       mutex_lock(&emu->register_mutex);
        snd_emux_sounds_off_all(p);
        snd_soundfont_close_check(emu->sflist, SF_CLIENT_NO(p->chset.port));
        snd_seq_event_port_detach(p->chset.client, p->chset.port);
        snd_emux_dec_count(emu);
 
-       up(&emu->register_mutex);
+       mutex_unlock(&emu->register_mutex);
        return 0;
 }
 
@@ -200,25 +209,28 @@ snd_emux_close_seq_oss(snd_seq_oss_arg_t *arg)
  * load patch
  */
 static int
-snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format,
+snd_emux_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format,
                            const char __user *buf, int offs, int count)
 {
-       snd_emux_t *emu;
-       snd_emux_port_t *p;
+       struct snd_emux *emu;
+       struct snd_emux_port *p;
        int rc;
 
-       snd_assert(arg != NULL, return -ENXIO);
+       if (snd_BUG_ON(!arg))
+               return -ENXIO;
        p = arg->private_data;
-       snd_assert(p != NULL, return -ENXIO);
+       if (snd_BUG_ON(!p))
+               return -ENXIO;
 
        emu = p->emu;
-       snd_assert(emu != NULL, return -ENXIO);
+       if (snd_BUG_ON(!emu))
+               return -ENXIO;
 
        if (format == GUS_PATCH)
                rc = snd_soundfont_load_guspatch(emu->sflist, buf, count,
                                                 SF_CLIENT_NO(p->chset.port));
        else if (format == SNDRV_OSS_SOUNDFONT_PATCH) {
-               soundfont_patch_info_t patch;
+               struct soundfont_patch_info patch;
                if (count < (int)sizeof(patch))
                        rc = -EINVAL;
                if (copy_from_user(&patch, buf, sizeof(patch)))
@@ -242,17 +254,20 @@ snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format,
  * ioctl
  */
 static int
-snd_emux_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long ioarg)
+snd_emux_ioctl_seq_oss(struct snd_seq_oss_arg *arg, unsigned int cmd, unsigned long ioarg)
 {
-       snd_emux_port_t *p;
-       snd_emux_t *emu;
+       struct snd_emux_port *p;
+       struct snd_emux *emu;
 
-       snd_assert(arg != NULL, return -ENXIO);
+       if (snd_BUG_ON(!arg))
+               return -ENXIO;
        p = arg->private_data;
-       snd_assert(p != NULL, return -ENXIO);
+       if (snd_BUG_ON(!p))
+               return -ENXIO;
 
        emu = p->emu;
-       snd_assert(emu != NULL, return -ENXIO);
+       if (snd_BUG_ON(!emu))
+               return -ENXIO;
 
        switch (cmd) {
        case SNDCTL_SEQ_RESETSAMPLES:
@@ -273,13 +288,15 @@ snd_emux_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long i
  * reset device
  */
 static int
-snd_emux_reset_seq_oss(snd_seq_oss_arg_t *arg)
+snd_emux_reset_seq_oss(struct snd_seq_oss_arg *arg)
 {
-       snd_emux_port_t *p;
+       struct snd_emux_port *p;
 
-       snd_assert(arg != NULL, return -ENXIO);
+       if (snd_BUG_ON(!arg))
+               return -ENXIO;
        p = arg->private_data;
-       snd_assert(p != NULL, return -ENXIO);
+       if (snd_BUG_ON(!p))
+               return -ENXIO;
        snd_emux_reset_port(p);
        return 0;
 }
@@ -289,17 +306,19 @@ snd_emux_reset_seq_oss(snd_seq_oss_arg_t *arg)
  * receive raw events: only SEQ_PRIVATE is accepted.
  */
 static int
-snd_emux_event_oss_input(snd_seq_event_t *ev, int direct, void *private_data,
+snd_emux_event_oss_input(struct snd_seq_event *ev, int direct, void *private_data,
                         int atomic, int hop)
 {
-       snd_emux_t *emu;
-       snd_emux_port_t *p;
+       struct snd_emux *emu;
+       struct snd_emux_port *p;
        unsigned char cmd, *data;
 
        p = private_data;
-       snd_assert(p != NULL, return -EINVAL);
+       if (snd_BUG_ON(!p))
+               return -EINVAL;
        emu = p->emu;
-       snd_assert(emu != NULL, return -EINVAL);
+       if (snd_BUG_ON(!emu))
+               return -EINVAL;
        if (ev->type != SNDRV_SEQ_EVENT_OSS)
                return snd_emux_event_input(ev, direct, private_data, atomic, hop);
 
@@ -320,14 +339,14 @@ snd_emux_event_oss_input(snd_seq_event_t *ev, int direct, void *private_data,
  * OSS/AWE driver specific h/w controls
  */
 static void
-emuspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd,
+emuspec_control(struct snd_emux *emu, struct snd_emux_port *port, int cmd,
                unsigned char *event, int atomic, int hop)
 {
        int voice;
        unsigned short p1;
        short p2;
        int i;
-       snd_midi_channel_t *chan;
+       struct snd_midi_channel *chan;
 
        voice = event[3];
        if (voice < 0 || voice >= port->chset.max_channels)
@@ -415,14 +434,14 @@ emuspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd,
 #include <linux/ultrasound.h>
 
 static void
-gusspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd,
+gusspec_control(struct snd_emux *emu, struct snd_emux_port *port, int cmd,
                unsigned char *event, int atomic, int hop)
 {
        int voice;
        unsigned short p1;
        short p2;
        int plong;
-       snd_midi_channel_t *chan;
+       struct snd_midi_channel *chan;
 
        if (port->port_mode != SNDRV_EMUX_PORT_MODE_OSS_SYNTH)
                return;
@@ -483,9 +502,9 @@ gusspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd,
  * send an event to midi emulation
  */
 static void
-fake_event(snd_emux_t *emu, snd_emux_port_t *port, int ch, int param, int val, int atomic, int hop)
+fake_event(struct snd_emux *emu, struct snd_emux_port *port, int ch, int param, int val, int atomic, int hop)
 {
-       snd_seq_event_t ev;
+       struct snd_seq_event ev;
        memset(&ev, 0, sizeof(ev));
        ev.type = SNDRV_SEQ_EVENT_CONTROLLER;
        ev.data.control.channel = ch;