aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc.h24
-rw-r--r--sound/soc/codecs/max98088.c2
-rw-r--r--sound/soc/codecs/max98095.c4
-rw-r--r--sound/soc/codecs/twl4030.c4
-rw-r--r--sound/soc/codecs/wm8904.c4
-rw-r--r--sound/soc/codecs/wm8958-dsp2.c8
-rw-r--r--sound/soc/codecs/wm8994.c4
-rw-r--r--sound/soc/codecs/wm8996.c2
-rw-r--r--sound/soc/omap/ams-delta.c2
-rw-r--r--sound/soc/soc-core.c18
-rw-r--r--sound/soc/soc-dapm.c22
11 files changed, 47 insertions, 47 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 9a001472b96a..66de6a70581e 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -162,19 +162,19 @@
162 .private_value = (unsigned long)&(struct soc_mixer_control) \ 162 .private_value = (unsigned long)&(struct soc_mixer_control) \
163 {.reg = xreg, .min = xmin, .max = xmax, \ 163 {.reg = xreg, .min = xmin, .max = xmax, \
164 .platform_max = xmax} } 164 .platform_max = xmax} }
165#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \ 165#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xitems, xtexts) \
166{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 166{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
167 .max = xmax, .texts = xtexts, \ 167 .items = xitems, .texts = xtexts, \
168 .mask = xmax ? roundup_pow_of_two(xmax) - 1 : 0} 168 .mask = xitems ? roundup_pow_of_two(xitems) - 1 : 0}
169#define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \ 169#define SOC_ENUM_SINGLE(xreg, xshift, xitems, xtexts) \
170 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts) 170 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xitems, xtexts)
171#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \ 171#define SOC_ENUM_SINGLE_EXT(xitems, xtexts) \
172{ .max = xmax, .texts = xtexts } 172{ .items = xitems, .texts = xtexts }
173#define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xmax, xtexts, xvalues) \ 173#define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \
174{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 174{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
175 .mask = xmask, .max = xmax, .texts = xtexts, .values = xvalues} 175 .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues}
176#define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xmax, xtexts, xvalues) \ 176#define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xnitmes, xtexts, xvalues) \
177 SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xmax, xtexts, xvalues) 177 SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xnitmes, xtexts, xvalues)
178#define SOC_ENUM(xname, xenum) \ 178#define SOC_ENUM(xname, xenum) \
179{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ 179{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
180 .info = snd_soc_info_enum_double, \ 180 .info = snd_soc_info_enum_double, \
@@ -1089,7 +1089,7 @@ struct soc_enum {
1089 unsigned short reg2; 1089 unsigned short reg2;
1090 unsigned char shift_l; 1090 unsigned char shift_l;
1091 unsigned char shift_r; 1091 unsigned char shift_r;
1092 unsigned int max; 1092 unsigned int items;
1093 unsigned int mask; 1093 unsigned int mask;
1094 const char * const *texts; 1094 const char * const *texts;
1095 const unsigned int *values; 1095 const unsigned int *values;
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index ee660e2d3df3..bb1ecfc4459b 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -1849,7 +1849,7 @@ static void max98088_handle_eq_pdata(struct snd_soc_codec *codec)
1849 1849
1850 /* Now point the soc_enum to .texts array items */ 1850 /* Now point the soc_enum to .texts array items */
1851 max98088->eq_enum.texts = max98088->eq_texts; 1851 max98088->eq_enum.texts = max98088->eq_texts;
1852 max98088->eq_enum.max = max98088->eq_textcnt; 1852 max98088->eq_enum.items = max98088->eq_textcnt;
1853 1853
1854 ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls)); 1854 ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls));
1855 if (ret != 0) 1855 if (ret != 0)
diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c
index 3ba1170ebb53..5bce9cde4a6d 100644
--- a/sound/soc/codecs/max98095.c
+++ b/sound/soc/codecs/max98095.c
@@ -1861,7 +1861,7 @@ static void max98095_handle_eq_pdata(struct snd_soc_codec *codec)
1861 1861
1862 /* Now point the soc_enum to .texts array items */ 1862 /* Now point the soc_enum to .texts array items */
1863 max98095->eq_enum.texts = max98095->eq_texts; 1863 max98095->eq_enum.texts = max98095->eq_texts;
1864 max98095->eq_enum.max = max98095->eq_textcnt; 1864 max98095->eq_enum.items = max98095->eq_textcnt;
1865 1865
1866 ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls)); 1866 ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls));
1867 if (ret != 0) 1867 if (ret != 0)
@@ -2016,7 +2016,7 @@ static void max98095_handle_bq_pdata(struct snd_soc_codec *codec)
2016 2016
2017 /* Now point the soc_enum to .texts array items */ 2017 /* Now point the soc_enum to .texts array items */
2018 max98095->bq_enum.texts = max98095->bq_texts; 2018 max98095->bq_enum.texts = max98095->bq_texts;
2019 max98095->bq_enum.max = max98095->bq_textcnt; 2019 max98095->bq_enum.items = max98095->bq_textcnt;
2020 2020
2021 ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls)); 2021 ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls));
2022 if (ret != 0) 2022 if (ret != 0)
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 00665ada23e2..1eb13d586309 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -975,13 +975,13 @@ static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol,
975 return -EBUSY; 975 return -EBUSY;
976 } 976 }
977 977
978 if (ucontrol->value.enumerated.item[0] > e->max - 1) 978 if (ucontrol->value.enumerated.item[0] >= e->items)
979 return -EINVAL; 979 return -EINVAL;
980 980
981 val = ucontrol->value.enumerated.item[0] << e->shift_l; 981 val = ucontrol->value.enumerated.item[0] << e->shift_l;
982 mask = e->mask << e->shift_l; 982 mask = e->mask << e->shift_l;
983 if (e->shift_l != e->shift_r) { 983 if (e->shift_l != e->shift_r) {
984 if (ucontrol->value.enumerated.item[1] > e->max - 1) 984 if (ucontrol->value.enumerated.item[1] >= e->items)
985 return -EINVAL; 985 return -EINVAL;
986 val |= ucontrol->value.enumerated.item[1] << e->shift_r; 986 val |= ucontrol->value.enumerated.item[1] << e->shift_r;
987 mask |= e->mask << e->shift_r; 987 mask |= e->mask << e->shift_r;
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 53bbfac6a83a..b2664ec901b9 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -1981,7 +1981,7 @@ static void wm8904_handle_retune_mobile_pdata(struct snd_soc_codec *codec)
1981 dev_dbg(codec->dev, "Allocated %d unique ReTune Mobile names\n", 1981 dev_dbg(codec->dev, "Allocated %d unique ReTune Mobile names\n",
1982 wm8904->num_retune_mobile_texts); 1982 wm8904->num_retune_mobile_texts);
1983 1983
1984 wm8904->retune_mobile_enum.max = wm8904->num_retune_mobile_texts; 1984 wm8904->retune_mobile_enum.items = wm8904->num_retune_mobile_texts;
1985 wm8904->retune_mobile_enum.texts = wm8904->retune_mobile_texts; 1985 wm8904->retune_mobile_enum.texts = wm8904->retune_mobile_texts;
1986 1986
1987 ret = snd_soc_add_codec_controls(codec, &control, 1); 1987 ret = snd_soc_add_codec_controls(codec, &control, 1);
@@ -2022,7 +2022,7 @@ static void wm8904_handle_pdata(struct snd_soc_codec *codec)
2022 for (i = 0; i < pdata->num_drc_cfgs; i++) 2022 for (i = 0; i < pdata->num_drc_cfgs; i++)
2023 wm8904->drc_texts[i] = pdata->drc_cfgs[i].name; 2023 wm8904->drc_texts[i] = pdata->drc_cfgs[i].name;
2024 2024
2025 wm8904->drc_enum.max = pdata->num_drc_cfgs; 2025 wm8904->drc_enum.items = pdata->num_drc_cfgs;
2026 wm8904->drc_enum.texts = wm8904->drc_texts; 2026 wm8904->drc_enum.texts = wm8904->drc_texts;
2027 2027
2028 ret = snd_soc_add_codec_controls(codec, &control, 1); 2028 ret = snd_soc_add_codec_controls(codec, &control, 1);
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c
index b7488f190d2b..19743779bf4d 100644
--- a/sound/soc/codecs/wm8958-dsp2.c
+++ b/sound/soc/codecs/wm8958-dsp2.c
@@ -944,7 +944,7 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
944 for (i = 0; i < pdata->num_mbc_cfgs; i++) 944 for (i = 0; i < pdata->num_mbc_cfgs; i++)
945 wm8994->mbc_texts[i] = pdata->mbc_cfgs[i].name; 945 wm8994->mbc_texts[i] = pdata->mbc_cfgs[i].name;
946 946
947 wm8994->mbc_enum.max = pdata->num_mbc_cfgs; 947 wm8994->mbc_enum.items = pdata->num_mbc_cfgs;
948 wm8994->mbc_enum.texts = wm8994->mbc_texts; 948 wm8994->mbc_enum.texts = wm8994->mbc_texts;
949 949
950 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, 950 ret = snd_soc_add_codec_controls(wm8994->hubs.codec,
@@ -973,7 +973,7 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
973 for (i = 0; i < pdata->num_vss_cfgs; i++) 973 for (i = 0; i < pdata->num_vss_cfgs; i++)
974 wm8994->vss_texts[i] = pdata->vss_cfgs[i].name; 974 wm8994->vss_texts[i] = pdata->vss_cfgs[i].name;
975 975
976 wm8994->vss_enum.max = pdata->num_vss_cfgs; 976 wm8994->vss_enum.items = pdata->num_vss_cfgs;
977 wm8994->vss_enum.texts = wm8994->vss_texts; 977 wm8994->vss_enum.texts = wm8994->vss_texts;
978 978
979 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, 979 ret = snd_soc_add_codec_controls(wm8994->hubs.codec,
@@ -1003,7 +1003,7 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
1003 for (i = 0; i < pdata->num_vss_hpf_cfgs; i++) 1003 for (i = 0; i < pdata->num_vss_hpf_cfgs; i++)
1004 wm8994->vss_hpf_texts[i] = pdata->vss_hpf_cfgs[i].name; 1004 wm8994->vss_hpf_texts[i] = pdata->vss_hpf_cfgs[i].name;
1005 1005
1006 wm8994->vss_hpf_enum.max = pdata->num_vss_hpf_cfgs; 1006 wm8994->vss_hpf_enum.items = pdata->num_vss_hpf_cfgs;
1007 wm8994->vss_hpf_enum.texts = wm8994->vss_hpf_texts; 1007 wm8994->vss_hpf_enum.texts = wm8994->vss_hpf_texts;
1008 1008
1009 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, 1009 ret = snd_soc_add_codec_controls(wm8994->hubs.codec,
@@ -1034,7 +1034,7 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
1034 for (i = 0; i < pdata->num_enh_eq_cfgs; i++) 1034 for (i = 0; i < pdata->num_enh_eq_cfgs; i++)
1035 wm8994->enh_eq_texts[i] = pdata->enh_eq_cfgs[i].name; 1035 wm8994->enh_eq_texts[i] = pdata->enh_eq_cfgs[i].name;
1036 1036
1037 wm8994->enh_eq_enum.max = pdata->num_enh_eq_cfgs; 1037 wm8994->enh_eq_enum.items = pdata->num_enh_eq_cfgs;
1038 wm8994->enh_eq_enum.texts = wm8994->enh_eq_texts; 1038 wm8994->enh_eq_enum.texts = wm8994->enh_eq_texts;
1039 1039
1040 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, 1040 ret = snd_soc_add_codec_controls(wm8994->hubs.codec,
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index b9be9cbc4603..8253c3c6db0e 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3237,7 +3237,7 @@ static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994)
3237 dev_dbg(codec->dev, "Allocated %d unique ReTune Mobile names\n", 3237 dev_dbg(codec->dev, "Allocated %d unique ReTune Mobile names\n",
3238 wm8994->num_retune_mobile_texts); 3238 wm8994->num_retune_mobile_texts);
3239 3239
3240 wm8994->retune_mobile_enum.max = wm8994->num_retune_mobile_texts; 3240 wm8994->retune_mobile_enum.items = wm8994->num_retune_mobile_texts;
3241 wm8994->retune_mobile_enum.texts = wm8994->retune_mobile_texts; 3241 wm8994->retune_mobile_enum.texts = wm8994->retune_mobile_texts;
3242 3242
3243 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, controls, 3243 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, controls,
@@ -3293,7 +3293,7 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
3293 for (i = 0; i < pdata->num_drc_cfgs; i++) 3293 for (i = 0; i < pdata->num_drc_cfgs; i++)
3294 wm8994->drc_texts[i] = pdata->drc_cfgs[i].name; 3294 wm8994->drc_texts[i] = pdata->drc_cfgs[i].name;
3295 3295
3296 wm8994->drc_enum.max = pdata->num_drc_cfgs; 3296 wm8994->drc_enum.items = pdata->num_drc_cfgs;
3297 wm8994->drc_enum.texts = wm8994->drc_texts; 3297 wm8994->drc_enum.texts = wm8994->drc_texts;
3298 3298
3299 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, controls, 3299 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, controls,
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index 1a7655b0aa22..ea6b587f65c1 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -2595,7 +2595,7 @@ static void wm8996_retune_mobile_pdata(struct snd_soc_codec *codec)
2595 dev_dbg(codec->dev, "Allocated %d unique ReTune Mobile names\n", 2595 dev_dbg(codec->dev, "Allocated %d unique ReTune Mobile names\n",
2596 wm8996->num_retune_mobile_texts); 2596 wm8996->num_retune_mobile_texts);
2597 2597
2598 wm8996->retune_mobile_enum.max = wm8996->num_retune_mobile_texts; 2598 wm8996->retune_mobile_enum.items = wm8996->num_retune_mobile_texts;
2599 wm8996->retune_mobile_enum.texts = wm8996->retune_mobile_texts; 2599 wm8996->retune_mobile_enum.texts = wm8996->retune_mobile_texts;
2600 2600
2601 ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls)); 2601 ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls));
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index 629446482a91..2eca91a51f51 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -103,7 +103,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
103 if (!codec->hw_write) 103 if (!codec->hw_write)
104 return -EUNATCH; 104 return -EUNATCH;
105 105
106 if (ucontrol->value.enumerated.item[0] >= control->max) 106 if (ucontrol->value.enumerated.item[0] >= control->items)
107 return -EINVAL; 107 return -EINVAL;
108 108
109 mutex_lock(&codec->mutex); 109 mutex_lock(&codec->mutex);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index fe1df50805a3..4372efb4e033 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2571,10 +2571,10 @@ int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
2571 2571
2572 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2572 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2573 uinfo->count = e->shift_l == e->shift_r ? 1 : 2; 2573 uinfo->count = e->shift_l == e->shift_r ? 1 : 2;
2574 uinfo->value.enumerated.items = e->max; 2574 uinfo->value.enumerated.items = e->items;
2575 2575
2576 if (uinfo->value.enumerated.item > e->max - 1) 2576 if (uinfo->value.enumerated.item >= e->items)
2577 uinfo->value.enumerated.item = e->max - 1; 2577 uinfo->value.enumerated.item = e->items - 1;
2578 strlcpy(uinfo->value.enumerated.name, 2578 strlcpy(uinfo->value.enumerated.name,
2579 e->texts[uinfo->value.enumerated.item], 2579 e->texts[uinfo->value.enumerated.item],
2580 sizeof(uinfo->value.enumerated.name)); 2580 sizeof(uinfo->value.enumerated.name));
@@ -2626,12 +2626,12 @@ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
2626 unsigned int val; 2626 unsigned int val;
2627 unsigned int mask; 2627 unsigned int mask;
2628 2628
2629 if (ucontrol->value.enumerated.item[0] > e->max - 1) 2629 if (ucontrol->value.enumerated.item[0] >= e->items)
2630 return -EINVAL; 2630 return -EINVAL;
2631 val = ucontrol->value.enumerated.item[0] << e->shift_l; 2631 val = ucontrol->value.enumerated.item[0] << e->shift_l;
2632 mask = e->mask << e->shift_l; 2632 mask = e->mask << e->shift_l;
2633 if (e->shift_l != e->shift_r) { 2633 if (e->shift_l != e->shift_r) {
2634 if (ucontrol->value.enumerated.item[1] > e->max - 1) 2634 if (ucontrol->value.enumerated.item[1] >= e->items)
2635 return -EINVAL; 2635 return -EINVAL;
2636 val |= ucontrol->value.enumerated.item[1] << e->shift_r; 2636 val |= ucontrol->value.enumerated.item[1] << e->shift_r;
2637 mask |= e->mask << e->shift_r; 2637 mask |= e->mask << e->shift_r;
@@ -2662,14 +2662,14 @@ int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol,
2662 2662
2663 reg_val = snd_soc_read(codec, e->reg); 2663 reg_val = snd_soc_read(codec, e->reg);
2664 val = (reg_val >> e->shift_l) & e->mask; 2664 val = (reg_val >> e->shift_l) & e->mask;
2665 for (mux = 0; mux < e->max; mux++) { 2665 for (mux = 0; mux < e->items; mux++) {
2666 if (val == e->values[mux]) 2666 if (val == e->values[mux])
2667 break; 2667 break;
2668 } 2668 }
2669 ucontrol->value.enumerated.item[0] = mux; 2669 ucontrol->value.enumerated.item[0] = mux;
2670 if (e->shift_l != e->shift_r) { 2670 if (e->shift_l != e->shift_r) {
2671 val = (reg_val >> e->shift_r) & e->mask; 2671 val = (reg_val >> e->shift_r) & e->mask;
2672 for (mux = 0; mux < e->max; mux++) { 2672 for (mux = 0; mux < e->items; mux++) {
2673 if (val == e->values[mux]) 2673 if (val == e->values[mux])
2674 break; 2674 break;
2675 } 2675 }
@@ -2700,12 +2700,12 @@ int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
2700 unsigned int val; 2700 unsigned int val;
2701 unsigned int mask; 2701 unsigned int mask;
2702 2702
2703 if (ucontrol->value.enumerated.item[0] > e->max - 1) 2703 if (ucontrol->value.enumerated.item[0] >= e->items)
2704 return -EINVAL; 2704 return -EINVAL;
2705 val = e->values[ucontrol->value.enumerated.item[0]] << e->shift_l; 2705 val = e->values[ucontrol->value.enumerated.item[0]] << e->shift_l;
2706 mask = e->mask << e->shift_l; 2706 mask = e->mask << e->shift_l;
2707 if (e->shift_l != e->shift_r) { 2707 if (e->shift_l != e->shift_r) {
2708 if (ucontrol->value.enumerated.item[1] > e->max - 1) 2708 if (ucontrol->value.enumerated.item[1] >= e->items)
2709 return -EINVAL; 2709 return -EINVAL;
2710 val |= e->values[ucontrol->value.enumerated.item[1]] << e->shift_r; 2710 val |= e->values[ucontrol->value.enumerated.item[1]] << e->shift_r;
2711 mask |= e->mask << e->shift_r; 2711 mask |= e->mask << e->shift_r;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index dc8ff13187f7..2026a64a0afb 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -535,7 +535,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
535 soc_widget_read(w, e->reg, &val); 535 soc_widget_read(w, e->reg, &val);
536 item = (val >> e->shift_l) & e->mask; 536 item = (val >> e->shift_l) & e->mask;
537 537
538 if (item < e->max && !strcmp(p->name, e->texts[item])) 538 if (item < e->items && !strcmp(p->name, e->texts[item]))
539 p->connect = 1; 539 p->connect = 1;
540 else 540 else
541 p->connect = 0; 541 p->connect = 0;
@@ -563,12 +563,12 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
563 563
564 soc_widget_read(w, e->reg, &val); 564 soc_widget_read(w, e->reg, &val);
565 val = (val >> e->shift_l) & e->mask; 565 val = (val >> e->shift_l) & e->mask;
566 for (item = 0; item < e->max; item++) { 566 for (item = 0; item < e->items; item++) {
567 if (val == e->values[item]) 567 if (val == e->values[item])
568 break; 568 break;
569 } 569 }
570 570
571 if (item < e->max && !strcmp(p->name, e->texts[item])) 571 if (item < e->items && !strcmp(p->name, e->texts[item]))
572 p->connect = 1; 572 p->connect = 1;
573 else 573 else
574 p->connect = 0; 574 p->connect = 0;
@@ -616,7 +616,7 @@ static int dapm_connect_mux(struct snd_soc_dapm_context *dapm,
616 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 616 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
617 int i; 617 int i;
618 618
619 for (i = 0; i < e->max; i++) { 619 for (i = 0; i < e->items; i++) {
620 if (!(strcmp(control_name, e->texts[i]))) { 620 if (!(strcmp(control_name, e->texts[i]))) {
621 list_add(&path->list, &dapm->card->paths); 621 list_add(&path->list, &dapm->card->paths);
622 list_add(&path->list_sink, &dest->sources); 622 list_add(&path->list_sink, &dest->sources);
@@ -2967,13 +2967,13 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
2967 struct snd_soc_dapm_update update; 2967 struct snd_soc_dapm_update update;
2968 int ret = 0; 2968 int ret = 0;
2969 2969
2970 if (ucontrol->value.enumerated.item[0] > e->max - 1) 2970 if (ucontrol->value.enumerated.item[0] >= e->items)
2971 return -EINVAL; 2971 return -EINVAL;
2972 mux = ucontrol->value.enumerated.item[0]; 2972 mux = ucontrol->value.enumerated.item[0];
2973 val = mux << e->shift_l; 2973 val = mux << e->shift_l;
2974 mask = e->mask << e->shift_l; 2974 mask = e->mask << e->shift_l;
2975 if (e->shift_l != e->shift_r) { 2975 if (e->shift_l != e->shift_r) {
2976 if (ucontrol->value.enumerated.item[1] > e->max - 1) 2976 if (ucontrol->value.enumerated.item[1] >= e->items)
2977 return -EINVAL; 2977 return -EINVAL;
2978 val |= ucontrol->value.enumerated.item[1] << e->shift_r; 2978 val |= ucontrol->value.enumerated.item[1] << e->shift_r;
2979 mask |= e->mask << e->shift_r; 2979 mask |= e->mask << e->shift_r;
@@ -3036,7 +3036,7 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,
3036 int change; 3036 int change;
3037 int ret = 0; 3037 int ret = 0;
3038 3038
3039 if (ucontrol->value.enumerated.item[0] >= e->max) 3039 if (ucontrol->value.enumerated.item[0] >= e->items)
3040 return -EINVAL; 3040 return -EINVAL;
3041 3041
3042 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 3042 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
@@ -3077,14 +3077,14 @@ int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol,
3077 3077
3078 reg_val = snd_soc_read(codec, e->reg); 3078 reg_val = snd_soc_read(codec, e->reg);
3079 val = (reg_val >> e->shift_l) & e->mask; 3079 val = (reg_val >> e->shift_l) & e->mask;
3080 for (mux = 0; mux < e->max; mux++) { 3080 for (mux = 0; mux < e->items; mux++) {
3081 if (val == e->values[mux]) 3081 if (val == e->values[mux])
3082 break; 3082 break;
3083 } 3083 }
3084 ucontrol->value.enumerated.item[0] = mux; 3084 ucontrol->value.enumerated.item[0] = mux;
3085 if (e->shift_l != e->shift_r) { 3085 if (e->shift_l != e->shift_r) {
3086 val = (reg_val >> e->shift_r) & e->mask; 3086 val = (reg_val >> e->shift_r) & e->mask;
3087 for (mux = 0; mux < e->max; mux++) { 3087 for (mux = 0; mux < e->items; mux++) {
3088 if (val == e->values[mux]) 3088 if (val == e->values[mux])
3089 break; 3089 break;
3090 } 3090 }
@@ -3119,13 +3119,13 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
3119 struct snd_soc_dapm_update update; 3119 struct snd_soc_dapm_update update;
3120 int ret = 0; 3120 int ret = 0;
3121 3121
3122 if (ucontrol->value.enumerated.item[0] > e->max - 1) 3122 if (ucontrol->value.enumerated.item[0] >= e->items)
3123 return -EINVAL; 3123 return -EINVAL;
3124 mux = ucontrol->value.enumerated.item[0]; 3124 mux = ucontrol->value.enumerated.item[0];
3125 val = e->values[ucontrol->value.enumerated.item[0]] << e->shift_l; 3125 val = e->values[ucontrol->value.enumerated.item[0]] << e->shift_l;
3126 mask = e->mask << e->shift_l; 3126 mask = e->mask << e->shift_l;
3127 if (e->shift_l != e->shift_r) { 3127 if (e->shift_l != e->shift_r) {
3128 if (ucontrol->value.enumerated.item[1] > e->max - 1) 3128 if (ucontrol->value.enumerated.item[1] >= e->items)
3129 return -EINVAL; 3129 return -EINVAL;
3130 val |= e->values[ucontrol->value.enumerated.item[1]] << e->shift_r; 3130 val |= e->values[ucontrol->value.enumerated.item[1]] << e->shift_r;
3131 mask |= e->mask << e->shift_r; 3131 mask |= e->mask << e->shift_r;