Skip to content

Commit 154a0fd

Browse files
tiwaibroonie
authored andcommitted
ASoC: wl1273: Fix enum ctl accesses in a wrong type
"Codec Mode" and "Audio Switch" ctls in wl1273 codec driver are enum, while the current driver accesses wrongly via value.integer.value[]. They have to be via value.enumerated.item[] instead. Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 92e963f commit 154a0fd

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

sound/soc/codecs/wl1273.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static int snd_wl1273_get_audio_route(struct snd_kcontrol *kcontrol,
175175
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
176176
struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
177177

178-
ucontrol->value.integer.value[0] = wl1273->mode;
178+
ucontrol->value.enumerated.item[0] = wl1273->mode;
179179

180180
return 0;
181181
}
@@ -193,18 +193,17 @@ static int snd_wl1273_set_audio_route(struct snd_kcontrol *kcontrol,
193193
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
194194
struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
195195

196-
if (wl1273->mode == ucontrol->value.integer.value[0])
196+
if (wl1273->mode == ucontrol->value.enumerated.item[0])
197197
return 0;
198198

199199
/* Do not allow changes while stream is running */
200200
if (snd_soc_codec_is_active(codec))
201201
return -EPERM;
202202

203-
if (ucontrol->value.integer.value[0] < 0 ||
204-
ucontrol->value.integer.value[0] >= ARRAY_SIZE(wl1273_audio_route))
203+
if (ucontrol->value.enumerated.item[0] >= ARRAY_SIZE(wl1273_audio_route))
205204
return -EINVAL;
206205

207-
wl1273->mode = ucontrol->value.integer.value[0];
206+
wl1273->mode = ucontrol->value.enumerated.item[0];
208207

209208
return 1;
210209
}
@@ -219,7 +218,7 @@ static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol,
219218

220219
dev_dbg(codec->dev, "%s: enter.\n", __func__);
221220

222-
ucontrol->value.integer.value[0] = wl1273->core->audio_mode;
221+
ucontrol->value.enumerated.item[0] = wl1273->core->audio_mode;
223222

224223
return 0;
225224
}
@@ -233,7 +232,7 @@ static int snd_wl1273_fm_audio_put(struct snd_kcontrol *kcontrol,
233232

234233
dev_dbg(codec->dev, "%s: enter.\n", __func__);
235234

236-
val = ucontrol->value.integer.value[0];
235+
val = ucontrol->value.enumerated.item[0];
237236
if (wl1273->core->audio_mode == val)
238237
return 0;
239238

0 commit comments

Comments
 (0)