ALSA: wss_lib: rename cs4231.h into wss.h
[linux-2.6.git] / sound / isa / opti9xx / miro.c
index 33471bd..59f7c55 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>
@@ -137,8 +136,6 @@ struct snd_miro {
 
 static void snd_miro_proc_init(struct snd_miro * miro);
 
-#define DRIVER_NAME "snd-miro"
-
 static char * snd_opti9xx_names[] = {
        "unkown",
        "82C928", "82C929",
@@ -244,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)
@@ -346,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)
@@ -499,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) 
@@ -536,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;
 
@@ -678,7 +669,7 @@ 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;
@@ -1423,13 +1414,15 @@ static int __devexit snd_miro_remove(struct device *devptr, unsigned int dev)
        return 0;
 }
 
+#define DEV_NAME "miro"
+
 static struct isa_driver snd_miro_driver = {
        .match          = snd_miro_match,
        .probe          = snd_miro_probe,
        .remove         = __devexit_p(snd_miro_remove),
        /* FIXME: suspend/resume */
        .driver         = {
-               .name   = DRIVER_NAME
+               .name   = DEV_NAME
        },
 };