public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: broonie@kernel.org
Cc: alsa-devel@alsa-project.org, lars@metafoo.de,
	lgirdwood@gmail.com, patches@opensource.wolfsonmicro.com
Subject: [PATCH 1/2] ASoC: dapm: Break out of widget search when source and sink are located
Date: Thu,  7 May 2015 11:33:58 +0100	[thread overview]
Message-ID: <1430994839-32584-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> (raw)

Currently snd_soc_dapm_add_route will continue to search the widget list
even after both the source and sink for the route have been located.
This patch breaks out of the search when both are located giving a
small improvement in probe time for drivers.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---

Note these patches depend on:

commit 92fa12426741d52b39ec92ad77c9843d3fc2b3d6
Author: Lars-Peter Clausen <lars@metafoo.de>
Date:   Fri May 1 18:02:42 2015 +0200

    ASoC: dapm: Add new widgets to the end of the widget list

Thanks,
Charles

 sound/soc/soc-dapm.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index a2e5f22..ea3348e 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2617,14 +2617,20 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
 	list_for_each_entry(w, &dapm->card->widgets, list) {
 		if (!wsink && !(strcmp(w->name, sink))) {
 			wtsink = w;
-			if (w->dapm == dapm)
+			if (w->dapm == dapm) {
 				wsink = w;
+				if (wsource)
+					break;
+			}
 			continue;
 		}
 		if (!wsource && !(strcmp(w->name, source))) {
 			wtsource = w;
-			if (w->dapm == dapm)
+			if (w->dapm == dapm) {
 				wsource = w;
+				if (wsink)
+					break;
+			}
 		}
 	}
 	/* use widget from another DAPM context if not found from this */
-- 
1.7.2.5

             reply	other threads:[~2015-05-07 10:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-07 10:33 Charles Keepax [this message]
2015-05-07 10:33 ` [PATCH 2/2] ASoC: dapm: Add cache to speed up adding of routes Charles Keepax
2015-05-07 11:22   ` Lars-Peter Clausen
2015-05-07 12:35     ` Charles Keepax
2015-05-07 12:39     ` Mike Looijmans
2015-05-07 13:16     ` Mark Brown
2015-05-07 12:48   ` Mark Brown
2015-05-07 13:52     ` Charles Keepax
2015-05-07 14:09       ` Mark Brown
2015-05-07 14:53     ` Lars-Peter Clausen
2015-05-07 16:33       ` Mark Brown
2015-05-07 11:24 ` [PATCH 1/2] ASoC: dapm: Break out of widget search when source and sink are located Lars-Peter Clausen
2015-05-07 11:25 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430994839-32584-1-git-send-email-ckeepax@opensource.wolfsonmicro.com \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=patches@opensource.wolfsonmicro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox