Commit 1642e3d4 authored by Mark Brown's avatar 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: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent d4a8da91
......@@ -1786,19 +1786,19 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
mutex_lock(&widget->codec->mutex);
widget->value = val;
dapm_mux_update_power(widget, kcontrol, mask, mux, val, e);
if (widget->event) {
if (widget->event_flags & SND_SOC_DAPM_PRE_REG) {
ret = widget->event(widget,
kcontrol, SND_SOC_DAPM_PRE_REG);
if (ret < 0)
goto out;
}
ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
if (widget->event_flags & SND_SOC_DAPM_POST_REG)
ret = widget->event(widget,
kcontrol, SND_SOC_DAPM_POST_REG);
} else
ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
if (widget->event_flags & SND_SOC_DAPM_PRE_REG) {
ret = widget->event(widget,
kcontrol, SND_SOC_DAPM_PRE_REG);
if (ret < 0)
goto out;
}
ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
if (widget->event_flags & SND_SOC_DAPM_POST_REG)
ret = widget->event(widget,
kcontrol, SND_SOC_DAPM_POST_REG);
out:
mutex_unlock(&widget->codec->mutex);
......@@ -1883,19 +1883,19 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
mutex_lock(&widget->codec->mutex);
widget->value = val;
dapm_mux_update_power(widget, kcontrol, mask, mux, val, e);
if (widget->event) {
if (widget->event_flags & SND_SOC_DAPM_PRE_REG) {
ret = widget->event(widget,
kcontrol, SND_SOC_DAPM_PRE_REG);
if (ret < 0)
goto out;
}
ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
if (widget->event_flags & SND_SOC_DAPM_POST_REG)
ret = widget->event(widget,
kcontrol, SND_SOC_DAPM_POST_REG);
} else
ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
if (widget->event_flags & SND_SOC_DAPM_PRE_REG) {
ret = widget->event(widget,
kcontrol, SND_SOC_DAPM_PRE_REG);
if (ret < 0)
goto out;
}
ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
if (widget->event_flags & SND_SOC_DAPM_POST_REG)
ret = widget->event(widget,
kcontrol, SND_SOC_DAPM_POST_REG);
out:
mutex_unlock(&widget->codec->mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment