summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-09-28 18:28:23 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-04 16:50:19 +0100
commitd805002befc52a7edbfb0ec202a10a767e67515d (patch)
tree81a4e0f4d9ba2a7abcebe373cf55ed781a8b1873 /sound/soc/soc-dapm.c
parent35c64bcad5c8244d973efbf7e58f6e0e09635504 (diff)
ASoC: Factor out widget power check operation
We've got the same code in two different places, let's have it in a single place instead. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 8d760449965..c1f3563133b 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -771,6 +771,14 @@ int dapm_reg_event(struct snd_soc_dapm_widget *w,
}
EXPORT_SYMBOL_GPL(dapm_reg_event);
+static int dapm_widget_power_check(struct snd_soc_dapm_widget *w)
+{
+ if (w->force)
+ return 1;
+ else
+ return w->power_check(w);
+}
+
/* Generic check to see if a widget should be powered.
*/
static int dapm_generic_check_power(struct snd_soc_dapm_widget *w)
@@ -840,13 +848,7 @@ static int dapm_supply_check_power(struct snd_soc_dapm_widget *w)
if (!path->sink)
continue;
- if (path->sink->force) {
- power = 1;
- break;
- }
-
- if (path->sink->power_check &&
- path->sink->power_check(path->sink)) {
+ if (dapm_widget_power_check(path->sink)) {
power = 1;
break;
}
@@ -1234,10 +1236,7 @@ static void dapm_power_one_widget(struct snd_soc_dapm_widget *w,
break;
default:
- if (!w->force)
- power = w->power_check(w);
- else
- power = 1;
+ power = dapm_widget_power_check(w);
dapm_widget_set_power(w, power, up_list, down_list);
break;