提交 1642e3d4 编写于 作者: M Mark Brown

ASoC: Simplify code for DAPM widget updates

We don't need to check for an event callback since we also check for
an appropriate event flag when applying mux status changes.
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 d4a8da91
...@@ -1786,19 +1786,19 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, ...@@ -1786,19 +1786,19 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
mutex_lock(&widget->codec->mutex); mutex_lock(&widget->codec->mutex);
widget->value = val; widget->value = val;
dapm_mux_update_power(widget, kcontrol, mask, mux, val, e); dapm_mux_update_power(widget, kcontrol, mask, mux, val, e);
if (widget->event) {
if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { if (widget->event_flags & SND_SOC_DAPM_PRE_REG) {
ret = widget->event(widget, ret = widget->event(widget,
kcontrol, SND_SOC_DAPM_PRE_REG); kcontrol, SND_SOC_DAPM_PRE_REG);
if (ret < 0) if (ret < 0)
goto out; goto out;
} }
ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
if (widget->event_flags & SND_SOC_DAPM_POST_REG) ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
ret = widget->event(widget,
kcontrol, SND_SOC_DAPM_POST_REG); if (widget->event_flags & SND_SOC_DAPM_POST_REG)
} else ret = widget->event(widget,
ret = snd_soc_update_bits(widget->codec, e->reg, mask, val); kcontrol, SND_SOC_DAPM_POST_REG);
out: out:
mutex_unlock(&widget->codec->mutex); mutex_unlock(&widget->codec->mutex);
...@@ -1883,19 +1883,19 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, ...@@ -1883,19 +1883,19 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
mutex_lock(&widget->codec->mutex); mutex_lock(&widget->codec->mutex);
widget->value = val; widget->value = val;
dapm_mux_update_power(widget, kcontrol, mask, mux, val, e); dapm_mux_update_power(widget, kcontrol, mask, mux, val, e);
if (widget->event) {
if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { if (widget->event_flags & SND_SOC_DAPM_PRE_REG) {
ret = widget->event(widget, ret = widget->event(widget,
kcontrol, SND_SOC_DAPM_PRE_REG); kcontrol, SND_SOC_DAPM_PRE_REG);
if (ret < 0) if (ret < 0)
goto out; goto out;
} }
ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
if (widget->event_flags & SND_SOC_DAPM_POST_REG) ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
ret = widget->event(widget,
kcontrol, SND_SOC_DAPM_POST_REG); if (widget->event_flags & SND_SOC_DAPM_POST_REG)
} else ret = widget->event(widget,
ret = snd_soc_update_bits(widget->codec, e->reg, mask, val); kcontrol, SND_SOC_DAPM_POST_REG);
out: out:
mutex_unlock(&widget->codec->mutex); mutex_unlock(&widget->codec->mutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册