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

Lars-Peter Clausen lars at metafoo.de
Tue Sep 2 16:56:12 CEST 2014


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