From: mengdong.lin@linux.intel.com
To: alsa-devel@alsa-project.org, broonie@kernel.org
Cc: Mengdong Lin <mengdong.lin@linux.intel.com>,
tiwai@suse.de, mengdong.lin@intel.com,
guneshwor.o.singh@intel.com, liam.r.girdwood@linux.intel.com,
vinod.koul@intel.com, hardik.t.shah@intel.com
Subject: [PATCH 12/13] ASoC: Probe link components after finding new links
Date: Fri, 19 Aug 2016 18:14:32 +0800 [thread overview]
Message-ID: <823f27d0ca644b75c29246715d0c9c06d3ceb49f.1471599648.git.mengdong.lin@linux.intel.com> (raw)
In-Reply-To: <cover.1471599648.git.mengdong.lin@linux.intel.com>
From: Mengdong Lin <mengdong.lin@linux.intel.com>
Probing link components may bring new links from topolgy and these new
links may need new components. So there will be multiple rounds of
components probing until there is no new links found during the process.
Probing of aux_dev is moved earlier to simply the code. There is no need
to probe aux_devices multiple times.
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 6b1d198..dbd2169 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1862,6 +1862,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai_link *dai_link;
int ret, i, order;
+ bool find_new_link; /* topolgy may create new links */
mutex_lock(&client_mutex);
mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
@@ -1934,7 +1935,13 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
goto card_probe_error;
}
+ /* probe auxiliary components */
+ ret = soc_probe_aux_devices(card);
+ if (ret < 0)
+ goto probe_dai_err;
+
/* probe all components used by DAI links on this card */
+probe_link_cmpnt:
for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST;
order++) {
list_for_each_entry(rtd, &card->rtd_list, list) {
@@ -1948,18 +1955,15 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
}
}
- /* probe auxiliary components */
- ret = soc_probe_aux_devices(card);
- if (ret < 0)
- goto probe_dai_err;
-
/* Find new DAI links added during probing components and bind them.
* Components with topology may bring new DAIs and DAI links.
*/
+ find_new_link = false;
list_for_each_entry(dai_link, &card->dai_link_list, list) {
if (soc_is_dai_link_bound(card, dai_link))
continue;
+ find_new_link = true;
ret = soc_init_dai_link(card, dai_link);
if (ret)
goto probe_dai_err;
@@ -1968,6 +1972,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
goto probe_dai_err;
}
+ if (find_new_link) /* new link may have unprobed components */
+ goto probe_link_cmpnt;
+
/* probe all DAI links on this card */
for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST;
order++) {
--
2.5.0
next prev parent reply other threads:[~2016-08-19 10:08 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-19 10:11 [PATCH 00/13] ASoC: topology: Remaining kernel patches mengdong.lin
2016-08-19 10:12 ` [PATCH 01/13] ASoC: topology: Able to create BE DAIs mengdong.lin
2016-08-23 17:33 ` Mark Brown
2016-08-25 6:40 ` Mengdong Lin
2016-08-28 14:12 ` Mark Brown
2016-08-30 4:42 ` Mengdong Lin
2016-09-05 13:04 ` Mark Brown
2016-08-19 10:12 ` [PATCH 02/13] ASoC: topology: ABI - Add sig_bits to stream caps mengdong.lin
2016-08-22 17:59 ` Applied "ASoC: topology: ABI - Add sig_bits to stream caps" to the asoc tree Mark Brown
2016-08-19 10:12 ` [PATCH 03/13] ASoC: topology: ABI - Define DPCM trigger ordering for PCM mengdong.lin
2016-08-23 17:41 ` Mark Brown
2016-08-25 8:35 ` Mengdong Lin
2016-09-02 6:44 ` Mengdong Lin
2016-09-05 13:01 ` Mark Brown
2016-09-06 6:15 ` Mengdong Lin
2016-09-09 11:40 ` Mengdong Lin
2016-08-19 10:13 ` [PATCH 04/13] ASoC: topology: ABI - Add flags to PCM mengdong.lin
2016-08-19 10:13 ` [PATCH 05/13] ASoC: topology: ABI - Add private data " mengdong.lin
2016-08-19 10:13 ` [PATCH 06/13] ASoC: topology: Add FE DAIs only if not already added mengdong.lin
2016-08-19 10:13 ` [PATCH 07/13] ASoC: topology: ABI - Add name & component info to BE/CC links mengdong.lin
2016-08-19 10:13 ` [PATCH 08/13] ASoC: topology: ABI - Define DAI physical PCM data formats mengdong.lin
2016-08-19 10:13 ` [PATCH 09/13] ASoC: topology: ABI - Add HW configurations to BE/CC links mengdong.lin
2016-08-19 10:14 ` [PATCH 10/13] ASoC: topology: ABI - Add flags and private data " mengdong.lin
2016-08-19 10:14 ` [PATCH 11/13] ASoC: Define API to find a dai link by id mengdong.lin
2016-08-19 10:14 ` mengdong.lin [this message]
2016-08-19 10:14 ` [PATCH 13/13] ASoC: topology: Able to create BE DAI links mengdong.lin
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=823f27d0ca644b75c29246715d0c9c06d3ceb49f.1471599648.git.mengdong.lin@linux.intel.com \
--to=mengdong.lin@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=guneshwor.o.singh@intel.com \
--cc=hardik.t.shah@intel.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=mengdong.lin@intel.com \
--cc=tiwai@suse.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).