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: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Mark Brown 2009-10-05 16:24:26 +01:00
parent d4a8da910e
commit 1642e3d42a
1 changed files with 26 additions and 26 deletions

View File

@ -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,
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);