diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2008-07-17 10:06:50 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-07-17 10:17:16 -0400 |
commit | 2927d6eeca0a5004d81fa5bedbdf3f2b1b842903 (patch) | |
tree | af22c4afd917b02970cea2c94e405306d882c27b /sound/soc | |
parent | 462dba28e1921f19319d11a44b7bb97e72da2a79 (diff) |
ALSA: ASoC: Refactor DAPM event handler
The DAPM event callback code has many layers of indentation, taking it
over 80 columns. Refactor the code to give less indentation in order to
avoid checkpatch issues on further changes and exploding indentation.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/soc-dapm.c | 79 |
1 files changed, 41 insertions, 38 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 2c87061c2a6b..17698ef58dfb 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -586,45 +586,48 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event) | |||
586 | power_change = (w->power == power) ? 0: 1; | 586 | power_change = (w->power == power) ? 0: 1; |
587 | w->power = power; | 587 | w->power = power; |
588 | 588 | ||
589 | if (!power_change) | ||
590 | continue; | ||
591 | |||
589 | /* call any power change event handlers */ | 592 | /* call any power change event handlers */ |
590 | if (power_change) { | 593 | if (w->event) |
591 | if (w->event) { | 594 | pr_debug("power %s event for %s flags %x\n", |
592 | pr_debug("power %s event for %s flags %x\n", | 595 | w->power ? "on" : "off", |
593 | w->power ? "on" : "off", w->name, w->event_flags); | 596 | w->name, w->event_flags); |
594 | if (power) { | 597 | |
595 | /* power up event */ | 598 | /* power up pre event */ |
596 | if (w->event_flags & SND_SOC_DAPM_PRE_PMU) { | 599 | if (power && w->event && |
597 | ret = w->event(w, | 600 | (w->event_flags & SND_SOC_DAPM_PRE_PMU)) { |
598 | NULL, SND_SOC_DAPM_PRE_PMU); | 601 | ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMU); |
599 | if (ret < 0) | 602 | if (ret < 0) |
600 | return ret; | 603 | return ret; |
601 | } | 604 | } |
602 | dapm_update_bits(w); | 605 | |
603 | if (w->event_flags & SND_SOC_DAPM_POST_PMU){ | 606 | /* power down pre event */ |
604 | ret = w->event(w, | 607 | if (!power && w->event && |
605 | NULL, SND_SOC_DAPM_POST_PMU); | 608 | (w->event_flags & SND_SOC_DAPM_PRE_PMD)) { |
606 | if (ret < 0) | 609 | ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMD); |
607 | return ret; | 610 | if (ret < 0) |
608 | } | 611 | return ret; |
609 | } else { | 612 | } |
610 | /* power down event */ | 613 | |
611 | if (w->event_flags & SND_SOC_DAPM_PRE_PMD) { | 614 | dapm_update_bits(w); |
612 | ret = w->event(w, | 615 | |
613 | NULL, SND_SOC_DAPM_PRE_PMD); | 616 | /* power up post event */ |
614 | if (ret < 0) | 617 | if (power && w->event && |
615 | return ret; | 618 | (w->event_flags & SND_SOC_DAPM_POST_PMU)) { |
616 | } | 619 | ret = w->event(w, |
617 | dapm_update_bits(w); | 620 | NULL, SND_SOC_DAPM_POST_PMU); |
618 | if (w->event_flags & SND_SOC_DAPM_POST_PMD) { | 621 | if (ret < 0) |
619 | ret = w->event(w, | 622 | return ret; |
620 | NULL, SND_SOC_DAPM_POST_PMD); | 623 | } |
621 | if (ret < 0) | 624 | |
622 | return ret; | 625 | /* power down post event */ |
623 | } | 626 | if (!power && w->event && |
624 | } | 627 | (w->event_flags & SND_SOC_DAPM_POST_PMD)) { |
625 | } else | 628 | ret = w->event(w, NULL, SND_SOC_DAPM_POST_PMD); |
626 | /* no event handler */ | 629 | if (ret < 0) |
627 | dapm_update_bits(w); | 630 | return ret; |
628 | } | 631 | } |
629 | } | 632 | } |
630 | } | 633 | } |