ALSA: Kill snd_assert() in other places
[safe/jmp/linux-2.6] / sound / sparc / amd7930.c
index ba1b2a3..49acee0 100644 (file)
@@ -36,7 +36,6 @@
 #include <linux/interrupt.h>
 #include <linux/moduleparam.h>
 
-#include <sound/driver.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/info.h>
@@ -491,7 +490,7 @@ static void __amd7930_update_map(struct snd_amd7930 *amd)
        __amd7930_write_map(amd);
 }
 
-static irqreturn_t snd_amd7930_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t snd_amd7930_interrupt(int irq, void *dev_id)
 {
        struct snd_amd7930 *amd = dev_id;
        unsigned int elapsed;
@@ -755,7 +754,7 @@ static struct snd_pcm_ops snd_amd7930_capture_ops = {
        .pointer        =       snd_amd7930_capture_pointer,
 };
 
-static int __init snd_amd7930_pcm(struct snd_amd7930 *amd)
+static int __devinit snd_amd7930_pcm(struct snd_amd7930 *amd)
 {
        struct snd_pcm *pcm;
        int err;
@@ -766,7 +765,6 @@ static int __init snd_amd7930_pcm(struct snd_amd7930 *amd)
                               /* playback count */ 1,
                               /* capture count */  1, &pcm)) < 0)
                return err;
-       snd_assert(pcm != NULL, return -EINVAL);
 
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_amd7930_playback_ops);
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_amd7930_capture_ops);
@@ -789,13 +787,6 @@ static int __init snd_amd7930_pcm(struct snd_amd7930 *amd)
 
 static int snd_amd7930_info_volume(struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
 {
-       int type = kctl->private_value;
-
-       snd_assert(type == VOLUME_MONITOR ||
-                  type == VOLUME_CAPTURE ||
-                  type == VOLUME_PLAYBACK, return -EINVAL);
-       (void) type;
-
        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
        uinfo->count = 1;
        uinfo->value.integer.min = 0;
@@ -810,10 +801,6 @@ static int snd_amd7930_get_volume(struct snd_kcontrol *kctl, struct snd_ctl_elem
        int type = kctl->private_value;
        int *swval;
 
-       snd_assert(type == VOLUME_MONITOR ||
-                  type == VOLUME_CAPTURE ||
-                  type == VOLUME_PLAYBACK, return -EINVAL);
-
        switch (type) {
        case VOLUME_MONITOR:
                swval = &amd->mgain;
@@ -839,10 +826,6 @@ static int snd_amd7930_put_volume(struct snd_kcontrol *kctl, struct snd_ctl_elem
        int type = kctl->private_value;
        int *swval, change;
 
-       snd_assert(type == VOLUME_MONITOR ||
-                  type == VOLUME_CAPTURE ||
-                  type == VOLUME_PLAYBACK, return -EINVAL);
-
        switch (type) {
        case VOLUME_MONITOR:
                swval = &amd->mgain;
@@ -859,7 +842,7 @@ static int snd_amd7930_put_volume(struct snd_kcontrol *kctl, struct snd_ctl_elem
        spin_lock_irqsave(&amd->lock, flags);
 
        if (*swval != ucontrol->value.integer.value[0]) {
-               *swval = ucontrol->value.integer.value[0];
+               *swval = ucontrol->value.integer.value[0] & 0xff;
                __amd7930_update_map(amd);
                change = 1;
        } else
@@ -870,7 +853,7 @@ static int snd_amd7930_put_volume(struct snd_kcontrol *kctl, struct snd_ctl_elem
        return change;
 }
 
-static struct snd_kcontrol_new amd7930_controls[] __initdata = {
+static struct snd_kcontrol_new amd7930_controls[] __devinitdata = {
        {
                .iface          =       SNDRV_CTL_ELEM_IFACE_MIXER,
                .name           =       "Monitor Volume",
@@ -900,12 +883,13 @@ static struct snd_kcontrol_new amd7930_controls[] __initdata = {
        },
 };
 
-static int __init snd_amd7930_mixer(struct snd_amd7930 *amd)
+static int __devinit snd_amd7930_mixer(struct snd_amd7930 *amd)
 {
        struct snd_card *card;
        int idx, err;
 
-       snd_assert(amd != NULL && amd->card != NULL, return -EINVAL);
+       if (snd_BUG_ON(!amd || !amd->card))
+               return -EINVAL;
 
        card = amd->card;
        strcpy(card->mixername, card->shortname);
@@ -945,11 +929,11 @@ static struct snd_device_ops snd_amd7930_dev_ops = {
        .dev_free       =       snd_amd7930_dev_free,
 };
 
-static int __init snd_amd7930_create(struct snd_card *card,
-                                    struct resource *rp,
-                                    unsigned int reg_size,
-                                    int irq, int dev,
-                                    struct snd_amd7930 **ramd)
+static int __devinit snd_amd7930_create(struct snd_card *card,
+                                       struct resource *rp,
+                                       unsigned int reg_size,
+                                       int irq, int dev,
+                                       struct snd_amd7930 **ramd)
 {
        unsigned long flags;
        struct snd_amd7930 *amd;
@@ -973,7 +957,7 @@ static int __init snd_amd7930_create(struct snd_card *card,
        amd7930_idle(amd);
 
        if (request_irq(irq, snd_amd7930_interrupt,
-                       SA_INTERRUPT | SA_SHIRQ, "amd7930", amd)) {
+                       IRQF_DISABLED | IRQF_SHARED, "amd7930", amd)) {
                snd_printk("amd7930-%d: Unable to grab IRQ %d\n",
                           dev, irq);
                snd_amd7930_free(amd);
@@ -1013,7 +997,7 @@ static int __init snd_amd7930_create(struct snd_card *card,
        return 0;
 }
 
-static int __init amd7930_attach_common(struct resource *rp, int irq)
+static int __devinit amd7930_attach_common(struct resource *rp, int irq)
 {
        static int dev_num;
        struct snd_card *card;
@@ -1033,10 +1017,10 @@ static int __init amd7930_attach_common(struct resource *rp, int irq)
 
        strcpy(card->driver, "AMD7930");
        strcpy(card->shortname, "Sun AMD7930");
-       sprintf(card->longname, "%s at 0x%02lx:0x%08lx, irq %d",
+       sprintf(card->longname, "%s at 0x%02lx:0x%08Lx, irq %d",
                card->shortname,
                rp->flags & 0xffL,
-               rp->start,
+               (unsigned long long)rp->start,
                irq);
 
        if ((err = snd_amd7930_create(card, rp,
@@ -1065,10 +1049,10 @@ out_err:
        return err;
 }
 
-static int __init amd7930_obio_attach(struct device_node *dp)
+static int __devinit amd7930_obio_attach(struct device_node *dp)
 {
-       struct linux_prom_registers *regs;
-       struct linux_prom_irqs *irqp;
+       const struct linux_prom_registers *regs;
+       const struct linux_prom_irqs *irqp;
        struct resource res, *rp;
        int len;