[alsa-devel] [PATCHv3 2/9] WM8971 uses SOC_ENUM_SINGLE_DECL to replace SOC_ENUM_SINGLE

Xavier Hsu xavier.hsu at linaro.org
Thu Sep 4 05:53:44 CEST 2014


Hi Charles and Lars-Peter :
Thanks for your feedback.
I will split into two patch (Modify De-emphasis and Using SOC_ENUM_SINGLE_DECL
macro to replace SOC_ENUM_SINGLE macro) and use local mutex to replace the
snd_soc_codec mutex.

Thanks.

BR,
Xavier


2014-09-02 22:56 GMT+08:00 Lars-Peter Clausen <lars at metafoo.de>:

> On 09/02/2014 05:27 AM, Xavier Hsu wrote:
> [...]
>
>  +static int wm8971_put_deemph(struct snd_kcontrol *kcontrol,
>> +                            struct snd_ctl_elem_value *ucontrol)
>> +{
>> +       struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
>> +       struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec);
>> +       int deemph = ucontrol->value.enumerated.item[0];
>> +       int ret = 0;
>> +
>> +       if (deemph > 1)
>> +               return -EINVAL;
>> +
>> +       mutex_lock(&codec->mutex);
>>
>
> Please use a driver local mutex. The snd_soc_codec mutex is going to be
> removed sooner or later and we shouldn't add new users.
>
>
>  +       if (wm8971->deemph != deemph) {
>> +               wm8971->deemph = deemph;
>> +               wm8971_set_deemph(codec);
>> +
>> +               ret = 1;
>> +       }
>> +       mutex_unlock(&codec->mutex);
>> +
>> +       return ret;
>> +}
>>
>
>


More information about the Alsa-devel mailing list