snd-ac97-codec: fix ac97_enum mixer elements
PATCH 1/1 snd-ac97-codec: fix ac97_enum mixer elements
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=1072
Signed-off-by Sergey Vlasov <[email protected]>
alsa-kernel/pci/ac97/ac97_codec.c renamed from alsa-kernel/pci/ac97/ac97_codec.c.fix-enum +2 -2
@@ -465,7 +465,7 @@ int snd_ac97_get_enum_double(snd_kcontrostruct 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_kcontrounsigned 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 ;