@@ -2403,6 +2403,15 @@ err:
return ret;
}
+#define snd_soc_dapm_route_scan(w, dapm, name, wnode, wtnode, node) \
+if (name && (!*wnode && !(strcmp(name, node)))) { \
+ *wtnode = w; \
+ if (w->dapm == dapm) \
+ *wnode = w; \
+ continue; \
+}
+
+
static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
const struct snd_soc_dapm_route *route)
{
@@ -2433,17 +2442,8 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
* current DAPM context
*/
list_for_each_entry(w, &dapm->card->widgets, list) {
- if (!wsink && !(strcmp(w->name, sink))) {
- wtsink = w;
- if (w->dapm == dapm)
- wsink = w;
- continue;
- }
- if (!wsource && !(strcmp(w->name, source))) {
- wtsource = w;
- if (w->dapm == dapm)
- wsource = w;
- }
+ snd_soc_dapm_route_scan(w, dapm, w->name, &wsource, &wtsource, source);
+ snd_soc_dapm_route_scan(w, dapm, w->name, &wsink, &wtsink, sink);
}
/* use widget from another DAPM context if not found from this */
if (!wsink)