提交 d805002b 编写于 作者: M Mark Brown

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: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 35c64bca
...@@ -771,6 +771,14 @@ int dapm_reg_event(struct snd_soc_dapm_widget *w, ...@@ -771,6 +771,14 @@ int dapm_reg_event(struct snd_soc_dapm_widget *w,
} }
EXPORT_SYMBOL_GPL(dapm_reg_event); 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. /* Generic check to see if a widget should be powered.
*/ */
static int dapm_generic_check_power(struct snd_soc_dapm_widget *w) 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) ...@@ -840,13 +848,7 @@ static int dapm_supply_check_power(struct snd_soc_dapm_widget *w)
if (!path->sink) if (!path->sink)
continue; continue;
if (path->sink->force) { if (dapm_widget_power_check(path->sink)) {
power = 1;
break;
}
if (path->sink->power_check &&
path->sink->power_check(path->sink)) {
power = 1; power = 1;
break; break;
} }
...@@ -1234,10 +1236,7 @@ static void dapm_power_one_widget(struct snd_soc_dapm_widget *w, ...@@ -1234,10 +1236,7 @@ static void dapm_power_one_widget(struct snd_soc_dapm_widget *w,
break; break;
default: default:
if (!w->force) power = dapm_widget_power_check(w);
power = w->power_check(w);
else
power = 1;
dapm_widget_set_power(w, power, up_list, down_list); dapm_widget_set_power(w, power, up_list, down_list);
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册