[alsa-devel] It seems return value of snd_soc_dapm_put_enum_double( ) is inverted

Tzung-Bi Shih tzungbi at google.com
Thu May 31 12:46:16 CEST 2018


Hi,

snd_soc_dapm_put_enum_double( ) returns 0 to indicate success;
otherwise an error number.  The value in the function is retrieved
from dapm_kcontrol_set_value( ).

> change = dapm_kcontrol_set_value(kcontrol, val);

However, dapm_kcontrol_set_value( ) returns a boolean.

> static bool dapm_kcontrol_set_value(const struct snd_kcontrol *kcontrol,
>        unsigned int value)
> {
>        struct dapm_kcontrol_data *data = snd_kcontrol_chip(kcontrol);
>
>        if (data->value == value)
>                return false;
>
>        if (data->widget)
>                data->widget->on_val = value;
>
>        data->value = value;
>
>        return true;
> }

If the value has updated successfully, dapm_kcontrol_set_value( ) will
return 1 and snd_soc_dapm_put_enum_double( ) will also return 1.  The
value is inverted.


More information about the Alsa-devel mailing list