]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/soc/codecs/tlv320aic3x.c
ASoC: TLV320AIC3X: Fix kcontrol's private value use in put callback
[linux-2.6-omap-h63xx.git] / sound / soc / codecs / tlv320aic3x.c
index b47a749c5ea2aecaf08e92fe0eb03b9538ad14f2..aea0cb72d80a9ad96f81f43e0454231c613cffbf 100644 (file)
@@ -165,10 +165,13 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
                                        struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
-       int reg = kcontrol->private_value & 0xff;
-       int shift = (kcontrol->private_value >> 8) & 0x0f;
-       int mask = (kcontrol->private_value >> 16) & 0xff;
-       int invert = (kcontrol->private_value >> 24) & 0x01;
+       struct soc_mixer_control *mc =
+               (struct soc_mixer_control *)kcontrol->private_value;
+       unsigned int reg = mc->reg;
+       unsigned int shift = mc->shift;
+       int max = mc->max;
+       unsigned int mask = (1 << fls(max)) - 1;
+       unsigned int invert = mc->invert;
        unsigned short val, val_mask;
        int ret;
        struct snd_soc_dapm_path *path;