Commit cc733900 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-core: remove dai_link_list

ASoC is using many lists.
Now, used dai_link is listed to card as dai_link_list.

	[card]->[dai_link]->[dai_link]->...

BTW, this "dai_link" is used to create "rtd".
And this rtd is listed to card as rtd_list.

	[card]->[rtd]->[rtd]->...

Here, each rtd has dai_link. This means, we can track all dai_link via
rtd list. This patch removes card dai_link_list, and uses rtd_list
instead of it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87fthtyq6z.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4f6250b8
...@@ -852,7 +852,6 @@ struct snd_soc_dai_link { ...@@ -852,7 +852,6 @@ struct snd_soc_dai_link {
/* Do not create a PCM for this DAI link (Backend link) */ /* Do not create a PCM for this DAI link (Backend link) */
unsigned int ignore:1; unsigned int ignore:1;
struct list_head list; /* DAI link list of the soc card */
#ifdef CONFIG_SND_SOC_TOPOLOGY #ifdef CONFIG_SND_SOC_TOPOLOGY
struct snd_soc_dobj dobj; /* For topology */ struct snd_soc_dobj dobj; /* For topology */
#endif #endif
...@@ -1037,7 +1036,6 @@ struct snd_soc_card { ...@@ -1037,7 +1036,6 @@ struct snd_soc_card {
/* CPU <--> Codec DAI links */ /* CPU <--> Codec DAI links */
struct snd_soc_dai_link *dai_link; /* predefined links only */ struct snd_soc_dai_link *dai_link; /* predefined links only */
int num_links; /* predefined links only */ int num_links; /* predefined links only */
struct list_head dai_link_list; /* all links */
struct list_head rtd_list; struct list_head rtd_list;
int num_rtd; int num_rtd;
...@@ -1107,11 +1105,6 @@ struct snd_soc_card { ...@@ -1107,11 +1105,6 @@ struct snd_soc_card {
((i) < (card)->num_aux_devs) && ((aux) = &(card)->aux_dev[i]); \ ((i) < (card)->num_aux_devs) && ((aux) = &(card)->aux_dev[i]); \
(i)++) (i)++)
#define for_each_card_links(card, link) \
list_for_each_entry(link, &(card)->dai_link_list, list)
#define for_each_card_links_safe(card, link, _link) \
list_for_each_entry_safe(link, _link, &(card)->dai_link_list, list)
#define for_each_card_rtds(card, rtd) \ #define for_each_card_rtds(card, rtd) \
list_for_each_entry(rtd, &(card)->rtd_list, list) list_for_each_entry(rtd, &(card)->rtd_list, list)
#define for_each_card_rtds_safe(card, rtd, _rtd) \ #define for_each_card_rtds_safe(card, rtd, _rtd) \
......
...@@ -934,11 +934,14 @@ struct snd_soc_dai_link *snd_soc_find_dai_link(struct snd_soc_card *card, ...@@ -934,11 +934,14 @@ struct snd_soc_dai_link *snd_soc_find_dai_link(struct snd_soc_card *card,
int id, const char *name, int id, const char *name,
const char *stream_name) const char *stream_name)
{ {
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai_link *link; struct snd_soc_dai_link *link;
lockdep_assert_held(&client_mutex); lockdep_assert_held(&client_mutex);
for_each_card_links(card, link) { for_each_card_rtds(card, rtd) {
link = rtd->dai_link;
if (link->id != id) if (link->id != id)
continue; continue;
...@@ -1075,8 +1078,6 @@ void snd_soc_remove_dai_link(struct snd_soc_card *card, ...@@ -1075,8 +1078,6 @@ void snd_soc_remove_dai_link(struct snd_soc_card *card,
if (card->remove_dai_link) if (card->remove_dai_link)
card->remove_dai_link(card, dai_link); card->remove_dai_link(card, dai_link);
list_del(&dai_link->list);
rtd = snd_soc_get_pcm_runtime(card, dai_link->name); rtd = snd_soc_get_pcm_runtime(card, dai_link->name);
if (rtd) if (rtd)
soc_free_pcm_runtime(rtd); soc_free_pcm_runtime(rtd);
...@@ -1158,9 +1159,6 @@ int snd_soc_add_dai_link(struct snd_soc_card *card, ...@@ -1158,9 +1159,6 @@ int snd_soc_add_dai_link(struct snd_soc_card *card,
} }
} }
/* see for_each_card_links */
list_add_tail(&dai_link->list, &card->dai_link_list);
return 0; return 0;
_err_defer: _err_defer:
...@@ -1931,7 +1929,7 @@ static void __soc_setup_card_name(char *name, int len, ...@@ -1931,7 +1929,7 @@ static void __soc_setup_card_name(char *name, int len,
static void soc_cleanup_card_resources(struct snd_soc_card *card, static void soc_cleanup_card_resources(struct snd_soc_card *card,
int card_probed) int card_probed)
{ {
struct snd_soc_dai_link *link, *_link; struct snd_soc_pcm_runtime *rtd, *n;
if (card->snd_card) if (card->snd_card)
snd_card_disconnect_sync(card->snd_card); snd_card_disconnect_sync(card->snd_card);
...@@ -1942,8 +1940,8 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card, ...@@ -1942,8 +1940,8 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card,
soc_remove_link_dais(card); soc_remove_link_dais(card);
soc_remove_link_components(card); soc_remove_link_components(card);
for_each_card_links_safe(card, link, _link) for_each_card_rtds_safe(card, rtd, n)
snd_soc_remove_dai_link(card, link); snd_soc_remove_dai_link(card, rtd->dai_link);
/* remove auxiliary devices */ /* remove auxiliary devices */
soc_remove_aux_devices(card); soc_remove_aux_devices(card);
...@@ -2393,7 +2391,6 @@ int snd_soc_register_card(struct snd_soc_card *card) ...@@ -2393,7 +2391,6 @@ int snd_soc_register_card(struct snd_soc_card *card)
INIT_LIST_HEAD(&card->aux_comp_list); INIT_LIST_HEAD(&card->aux_comp_list);
INIT_LIST_HEAD(&card->component_dev_list); INIT_LIST_HEAD(&card->component_dev_list);
INIT_LIST_HEAD(&card->list); INIT_LIST_HEAD(&card->list);
INIT_LIST_HEAD(&card->dai_link_list);
INIT_LIST_HEAD(&card->rtd_list); INIT_LIST_HEAD(&card->rtd_list);
INIT_LIST_HEAD(&card->dapm_dirty); INIT_LIST_HEAD(&card->dapm_dirty);
INIT_LIST_HEAD(&card->dobj_list); INIT_LIST_HEAD(&card->dobj_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment