提交 b16760bb 编写于 作者: S Sergey Vlasov 提交者: Jaroslav Kysela

[ALSA] fix behaviour of ac97_enum_mixer elements

AC97 Codec
ac97_enum mixer elements (e.g., 'Capture Source') did not work because
of wrong bitmask calculation in snd_ac97_get_enum_double() and
snd_ac97_put_enum_double().

https://bugtrack.alsa-project.org/alsa-bug/view.php?id=1072Signed-off-by: NSergey Vlasov <vsu@altlinux.ru>
Signed-off-by: NJaroslav Kysela <perex@suse.cz>
上级 ee733397
......@@ -465,7 +465,7 @@ int snd_ac97_get_enum_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * u
struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value;
unsigned short val, bitmask;
for (bitmask = 1; bitmask > e->mask; bitmask <<= 1)
for (bitmask = 1; bitmask < e->mask; bitmask <<= 1)
;
val = snd_ac97_read_cache(ac97, e->reg);
ucontrol->value.enumerated.item[0] = (val >> e->shift_l) & (bitmask - 1);
......@@ -482,7 +482,7 @@ int snd_ac97_put_enum_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * u
unsigned short val;
unsigned short mask, bitmask;
for (bitmask = 1; bitmask > e->mask; bitmask <<= 1)
for (bitmask = 1; bitmask < e->mask; bitmask <<= 1)
;
if (ucontrol->value.enumerated.item[0] > e->mask - 1)
return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册