diff mbox

[4/5] ASoC: dapm: Use snd_soc_dapm_add_path() in snd_soc_dapm_new_pcm()

Message ID 1399467948-8770-4-git-send-email-lars@metafoo.de (mailing list archive)
State New, archived
Headers show

Commit Message

Lars-Peter Clausen May 7, 2014, 1:05 p.m. UTC
We already know the widgets we want to connect, so use snd_soc_dapm_add_path()
instead of snd_soc_dapm_add_route() in snd_soc_dapm_new_pcm().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/soc-dapm.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Lars-Peter Clausen May 7, 2014, 1:35 p.m. UTC | #1
On 05/07/2014 03:05 PM, Lars-Peter Clausen wrote:
> @@ -3275,13 +3276,10 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
>
>   	memset(&routes, 0, sizeof(routes));
>
> -	routes[0].source = source->name;
> -	routes[0].sink = link_name;
> -	routes[1].source = link_name;
> -	routes[1].sink = sink->name;

The patch should probably also remove routes, as it is now unused...
diff mbox

Patch

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index e28ce91..de48cab 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3247,6 +3247,7 @@  int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 	struct snd_soc_dapm_widget *w;
 	size_t len;
 	char *link_name;
+	int ret;
 
 	len = strlen(source->name) + strlen(sink->name) + 2;
 	link_name = devm_kzalloc(card->dev, len, GFP_KERNEL);
@@ -3275,13 +3276,10 @@  int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 
 	memset(&routes, 0, sizeof(routes));
 
-	routes[0].source = source->name;
-	routes[0].sink = link_name;
-	routes[1].source = link_name;
-	routes[1].sink = sink->name;
-
-	return snd_soc_dapm_add_routes(&card->dapm, routes,
-				       ARRAY_SIZE(routes));
+	ret = snd_soc_dapm_add_path(&card->dapm, source, w, NULL, NULL);
+	if (ret)
+		return ret;
+	return snd_soc_dapm_add_path(&card->dapm, w, sink, NULL, NULL);
 }
 
 int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,