All of lore.kernel.org
 help / color / mirror / Atom feed
From: mengdong.lin@linux.intel.com
To: alsa-devel@alsa-project.org, broonie@kernel.org
Cc: Mengdong Lin <mengdong.lin@linux.intel.com>,
	vinod.koul@intel.com, mengdong.lin@intel.com,
	liam.r.girdwood@linux.intel.com, jeeja.kp@intel.com,
	subhransu.s.prusty@intel.com
Subject: [PATCH 3/5] ASoC: soc_bind_dai_link() directly returns success for a bound DAI link
Date: Wed,  2 Dec 2015 14:11:40 +0800	[thread overview]
Message-ID: <06e80a8f889459898722784788581647914dce9b.1449036307.git.mengdong.lin@linux.intel.com> (raw)
In-Reply-To: <cover.1449036307.git.mengdong.lin@linux.intel.com>

From: Mengdong Lin <mengdong.lin@linux.intel.com>

This function will return success immediately for a bound DAI link.
No need to look for the cpu/codec DAIs again.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c504d04..9dada21 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -960,6 +960,19 @@ static struct snd_soc_dai *snd_soc_find_dai(
 	return NULL;
 }
 
+static bool soc_is_dai_link_bound(struct snd_soc_card *card,
+		struct snd_soc_dai_link *dai_link)
+{
+	struct snd_soc_pcm_runtime *rtd;
+
+	list_for_each_entry(rtd, &card->rtd_list, list) {
+		if (rtd->dai_link == dai_link)
+			return true;
+	}
+
+	return false;
+}
+
 static int soc_bind_dai_link(struct snd_soc_card *card,
 	struct snd_soc_dai_link *dai_link)
 {
@@ -977,6 +990,12 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
 	if (!rtd)
 		return -ENOMEM;
 
+	if (soc_is_dai_link_bound(card, dai_link)) {
+		dev_dbg(card->dev, "ASoC: dai link %s already bound\n",
+			dai_link->name);
+		return 0;
+	}
+
 	cpu_dai_component.name = dai_link->cpu_name;
 	cpu_dai_component.of_node = dai_link->cpu_of_node;
 	cpu_dai_component.dai_name = dai_link->cpu_dai_name;
-- 
2.5.0

  parent reply	other threads:[~2015-12-02  5:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-02  6:08 [PATCH 0/5] ASoC: Allow topology to create DAI links mengdong.lin
2015-12-02  6:11 ` [PATCH 1/5] ASoC: Implement DAI links in a list & define API to add/remove a link mengdong.lin
2015-12-08 18:03   ` Mark Brown
2015-12-08 19:11   ` Applied "ASoC: Implement DAI links in a list & define API to add/remove a link" to the asoc tree Mark Brown
2015-12-02  6:11 ` [PATCH 2/5] ASoC: Define add/remove_dai_link ops for a soc card mengdong.lin
2015-12-08 19:11   ` Applied "ASoC: Define add/remove_dai_link ops for a soc card" to the asoc tree Mark Brown
2015-12-02  6:11 ` mengdong.lin [this message]
2015-12-02  6:11 ` [PATCH 4/5] ASoC: Bind new DAI links after probing components mengdong.lin
2015-12-02  6:11 ` [PATCH 5/5] ASoC: The soc card can have auxiliary components mengdong.lin
2015-12-08 18:58   ` Mark Brown
2015-12-09  9:09     ` Mengdong Lin
2015-12-09 20:38       ` Mark Brown
2015-12-10 10:05         ` Mengdong Lin
2015-12-11 20:22           ` Mark Brown
2015-12-15  8:06             ` Mengdong Lin
2015-12-15 11:23               ` Mark Brown
2015-12-16  8:33                 ` Mengdong Lin
2015-12-18  9:35                   ` Mark Brown
2015-12-22  8:15                   ` Can we remove the rtd_aux for the aux_devs? Mengdong Lin
2015-12-22 23:56                     ` 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=06e80a8f889459898722784788581647914dce9b.1449036307.git.mengdong.lin@linux.intel.com \
    --to=mengdong.lin@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jeeja.kp@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=mengdong.lin@intel.com \
    --cc=subhransu.s.prusty@intel.com \
    --cc=vinod.koul@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.