diff mbox

[1/2] ASoC: dapm: Break out of widget search when source and sink are located

Message ID 1430994839-32584-1-git-send-email-ckeepax@opensource.wolfsonmicro.com (mailing list archive)
State Accepted
Commit 70c751095d5481d246ae7ec622ed35a76ce6ff0c
Headers show

Commit Message

Charles Keepax May 7, 2015, 10:33 a.m. UTC
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(-)

Comments

Lars-Peter Clausen May 7, 2015, 11:24 a.m. UTC | #1
On 05/07/2015 12:33 PM, Charles Keepax wrote:
> 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>

Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Mark Brown May 7, 2015, 11:25 a.m. UTC | #2
On Thu, May 07, 2015 at 11:33:58AM +0100, Charles Keepax wrote:
> 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.

Applied, thanks.
diff mbox

Patch

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 */