]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: twl4030: Clean up duplicated code
authorTakashi Iwai <tiwai@suse.de>
Tue, 18 Feb 2014 07:56:39 +0000 (08:56 +0100)
committerMark Brown <broonie@linaro.org>
Thu, 20 Feb 2014 01:42:59 +0000 (10:42 +0900)
Remove the open code in snd_soc_put_twl4030_opmode_enum_double() but
just call snd_soc_put_enum_double() instead, which does the very same
thing (even correctly with a lock).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/codecs/twl4030.c

index 1eb13d586309fe9010e48ad750df95ce7124033e..682e4ac8893930e1ea2886a380307475d740d81b 100644 (file)
@@ -965,9 +965,6 @@ static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol,
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
        struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
-       struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
-       unsigned short val;
-       unsigned short mask;
 
        if (twl4030->configured) {
                dev_err(codec->dev,
@@ -975,19 +972,7 @@ static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol,
                return -EBUSY;
        }
 
-       if (ucontrol->value.enumerated.item[0] >= e->items)
-               return -EINVAL;
-
-       val = ucontrol->value.enumerated.item[0] << e->shift_l;
-       mask = e->mask << e->shift_l;
-       if (e->shift_l != e->shift_r) {
-               if (ucontrol->value.enumerated.item[1] >= e->items)
-                       return -EINVAL;
-               val |= ucontrol->value.enumerated.item[1] << e->shift_r;
-               mask |= e->mask << e->shift_r;
-       }
-
-       return snd_soc_update_bits(codec, e->reg, mask, val);
+       return snd_soc_put_enum_double(kcontrol, ucontrol);
 }
 
 /*