]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/isa/opti9xx/miro.c
ALSA: Kill snd_assert() in sound/isa/*
[linux-2.6-omap-h63xx.git] / sound / isa / opti9xx / miro.c
index cd29b30b362e4529601a105a5e26a05ca2da6e5a..440755cc00137c663e39c11e258c76ca5d944bed 100644 (file)
@@ -22,7 +22,6 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include <sound/driver.h>
 #include <linux/init.h>
 #include <linux/err.h>
 #include <linux/isa.h>
@@ -33,7 +32,7 @@
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <sound/core.h>
-#include <sound/cs4231.h>
+#include <sound/wss.h>
 #include <sound/mpu401.h>
 #include <sound/opl4.h>
 #include <sound/control.h>
@@ -242,14 +241,7 @@ static int aci_setvalue(struct snd_miro * miro, unsigned char index, int value)
  *  MIXER part
  */
 
-static int snd_miro_info_capture(struct snd_kcontrol *kcontrol,
-                                struct snd_ctl_elem_info *uinfo)
-{
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
-       uinfo->count = 1;
-
-       return 0;
-}
+#define snd_miro_info_capture  snd_ctl_boolean_mono_info
 
 static int snd_miro_get_capture(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_value *ucontrol)
@@ -344,14 +336,7 @@ static int snd_miro_put_preamp(struct snd_kcontrol *kcontrol,
        return change;
 }
 
-static int snd_miro_info_amp(struct snd_kcontrol *kcontrol,
-                            struct snd_ctl_elem_info *uinfo)
-{
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
-       uinfo->count = 1;
-
-       return 0;
-}
+#define snd_miro_info_amp      snd_ctl_boolean_mono_info
 
 static int snd_miro_get_amp(struct snd_kcontrol *kcontrol,
                            struct snd_ctl_elem_value *ucontrol)
@@ -497,6 +482,10 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol,
 
                /* equalizer elements */
 
+               if (left < -0x7f || left > 0x7f ||
+                   right < -0x7f || right > 0x7f)
+                       return -EINVAL;
+
                if (left_old > 0x80) 
                        left_old = 0x80 - left_old;
                if (right_old > 0x80) 
@@ -534,6 +523,10 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol,
 
                /* non-equalizer elements */
 
+               if (left < 0 || left > 0x20 ||
+                   right < 0 || right > 0x20)
+                       return -EINVAL;
+
                left_old = 0x20 - left_old;
                right_old = 0x20 - right_old;
 
@@ -676,13 +669,14 @@ static int __devinit snd_set_aci_init_values(struct snd_miro *miro)
        return 0;
 }
 
-static int snd_miro_mixer(struct snd_miro *miro)
+static int __devinit snd_miro_mixer(struct snd_miro *miro)
 {
        struct snd_card *card;
        unsigned int idx;
        int err;
 
-       snd_assert(miro != NULL && miro->card != NULL, return -EINVAL);
+       if (snd_BUG_ON(!miro || !miro->card))
+               return -EINVAL;
 
        card = miro->card;
 
@@ -1228,7 +1222,7 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n)
 
        int error;
        struct snd_miro *miro;
-       struct snd_cs4231 *codec;
+       struct snd_wss *codec;
        struct snd_timer *timer;
        struct snd_card *card;
        struct snd_pcm *pcm;
@@ -1317,29 +1311,32 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n)
                }
        }
 
-       if ((error = snd_miro_configure(miro))) {
+       error = snd_miro_configure(miro);
+       if (error) {
                snd_card_free(card);
                return error;
        }
 
-       if ((error = snd_cs4231_create(card, miro->wss_base + 4, -1,
-                                      miro->irq, miro->dma1, miro->dma2,
-                                      CS4231_HW_AD1845,
-                                      0,
-                                      &codec)) < 0) {
+       error = snd_wss_create(card, miro->wss_base + 4, -1,
+                               miro->irq, miro->dma1, miro->dma2,
+                               WSS_HW_AD1845, 0, &codec);
+       if (error < 0) {
                snd_card_free(card);
                return error;
        }
 
-       if ((error = snd_cs4231_pcm(codec, 0, &pcm)) < 0) {
+       error = snd_wss_pcm(codec, 0, &pcm);
+       if (error < 0)  {
                snd_card_free(card);
                return error;
        }
-       if ((error = snd_cs4231_mixer(codec)) < 0) {
+       error = snd_wss_mixer(codec);
+       if (error < 0) {
                snd_card_free(card);
                return error;
        }
-       if ((error = snd_cs4231_timer(codec, 0, &timer)) < 0) {
+       error = snd_wss_timer(codec, 0, &timer);
+       if (error < 0) {
                snd_card_free(card);
                return error;
        }