diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-28 12:02:31 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-10-04 11:50:17 -0400 |
commit | 05623c4314cba3971f8476151aff73126127925f (patch) | |
tree | c74ab55a9124a088f7fe233105431a1119973536 /sound/soc/soc-dapm.c | |
parent | aa59802dedac98dc95310a456121cec6a9d6b63f (diff) |
ASoC: Factor write of widget power out into a separate function
Split the decision about what the new power should be out from the
implementation of that decision.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r-- | sound/soc/soc-dapm.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index c277228ec967..dcbd4687b42f 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1197,6 +1197,23 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie) | |||
1197 | } | 1197 | } |
1198 | } | 1198 | } |
1199 | 1199 | ||
1200 | static void dapm_widget_set_power(struct snd_soc_dapm_widget *w, bool power, | ||
1201 | struct list_head *up_list, | ||
1202 | struct list_head *down_list) | ||
1203 | { | ||
1204 | if (w->power == power) | ||
1205 | return; | ||
1206 | |||
1207 | trace_snd_soc_dapm_widget_power(w, power); | ||
1208 | |||
1209 | if (power) | ||
1210 | dapm_seq_insert(w, up_list, true); | ||
1211 | else | ||
1212 | dapm_seq_insert(w, down_list, false); | ||
1213 | |||
1214 | w->power = power; | ||
1215 | } | ||
1216 | |||
1200 | static void dapm_power_one_widget(struct snd_soc_dapm_widget *w, | 1217 | static void dapm_power_one_widget(struct snd_soc_dapm_widget *w, |
1201 | struct list_head *up_list, | 1218 | struct list_head *up_list, |
1202 | struct list_head *down_list) | 1219 | struct list_head *down_list) |
@@ -1241,17 +1258,7 @@ static void dapm_power_one_widget(struct snd_soc_dapm_widget *w, | |||
1241 | } | 1258 | } |
1242 | } | 1259 | } |
1243 | 1260 | ||
1244 | if (w->power == power) | 1261 | dapm_widget_set_power(w, power, up_list, down_list); |
1245 | break; | ||
1246 | |||
1247 | trace_snd_soc_dapm_widget_power(w, power); | ||
1248 | |||
1249 | if (power) | ||
1250 | dapm_seq_insert(w, up_list, true); | ||
1251 | else | ||
1252 | dapm_seq_insert(w, down_list, false); | ||
1253 | |||
1254 | w->power = power; | ||
1255 | break; | 1262 | break; |
1256 | } | 1263 | } |
1257 | } | 1264 | } |