alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: [alsa-devel] [PATCH 01/14] ASoC: soc-core: remove dai_link_list
Date: 22 Nov 2019 14:38:38 +0900	[thread overview]
Message-ID: <87pnhk8o81.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87r2208o9g.wl-kuninori.morimoto.gx@renesas.com>


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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

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

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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc.h  |  7 -------
 sound/soc/soc-core.c | 17 +++++++----------
 2 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index c28a1ed..b7ba3b9 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -852,7 +852,6 @@ struct snd_soc_dai_link {
 	/* Do not create a PCM for this DAI link (Backend link) */
 	unsigned int ignore:1;
 
-	struct list_head list; /* DAI link list of the soc card */
 #ifdef CONFIG_SND_SOC_TOPOLOGY
 	struct snd_soc_dobj dobj; /* For topology */
 #endif
@@ -1037,7 +1036,6 @@ struct snd_soc_card {
 	/* CPU <--> Codec DAI links  */
 	struct snd_soc_dai_link *dai_link;  /* predefined links only */
 	int num_links;  /* predefined links only */
-	struct list_head dai_link_list; /* all links */
 
 	struct list_head rtd_list;
 	int num_rtd;
@@ -1107,11 +1105,6 @@ struct snd_soc_card {
 	     ((i) < (card)->num_aux_devs) && ((aux) = &(card)->aux_dev[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)			\
 	list_for_each_entry(rtd, &(card)->rtd_list, list)
 #define for_each_card_rtds_safe(card, rtd, _rtd)	\
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index cc0ef0f..19a2a89 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -934,11 +934,14 @@ struct snd_soc_dai_link *snd_soc_find_dai_link(struct snd_soc_card *card,
 					       int id, const char *name,
 					       const char *stream_name)
 {
+	struct snd_soc_pcm_runtime *rtd;
 	struct snd_soc_dai_link *link;
 
 	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)
 			continue;
 
@@ -1075,8 +1078,6 @@ void snd_soc_remove_dai_link(struct snd_soc_card *card,
 	if (card->remove_dai_link)
 		card->remove_dai_link(card, dai_link);
 
-	list_del(&dai_link->list);
-
 	rtd = snd_soc_get_pcm_runtime(card, dai_link->name);
 	if (rtd)
 		soc_free_pcm_runtime(rtd);
@@ -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;
 
 _err_defer:
@@ -1946,7 +1944,7 @@ static void __soc_setup_card_name(char *name, int len,
 static void soc_cleanup_card_resources(struct snd_soc_card *card,
 				       int card_probed)
 {
-	struct snd_soc_dai_link *link, *_link;
+	struct snd_soc_pcm_runtime *rtd, *n;
 
 	if (card->snd_card)
 		snd_card_disconnect_sync(card->snd_card);
@@ -1957,8 +1955,8 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card,
 	soc_remove_link_dais(card);
 	soc_remove_link_components(card);
 
-	for_each_card_links_safe(card, link, _link)
-		snd_soc_remove_dai_link(card, link);
+	for_each_card_rtds_safe(card, rtd, n)
+		snd_soc_remove_dai_link(card, rtd->dai_link);
 
 	/* remove auxiliary devices */
 	soc_remove_aux_devices(card);
@@ -2408,7 +2406,6 @@ int snd_soc_register_card(struct snd_soc_card *card)
 	INIT_LIST_HEAD(&card->aux_comp_list);
 	INIT_LIST_HEAD(&card->component_dev_list);
 	INIT_LIST_HEAD(&card->list);
-	INIT_LIST_HEAD(&card->dai_link_list);
 	INIT_LIST_HEAD(&card->rtd_list);
 	INIT_LIST_HEAD(&card->dapm_dirty);
 	INIT_LIST_HEAD(&card->dobj_list);
-- 
2.7.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2019-11-22  5:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22  5:37 [alsa-devel] [PATCH 00/14] ASoC: soc-core cleanup step6 Kuninori Morimoto
2019-11-22  5:38 ` Kuninori Morimoto [this message]
2019-11-22  5:38 ` [alsa-devel] [PATCH 02/14] ASoC: soc-core: remove snd_soc_disconnect_sync() Kuninori Morimoto
2019-11-22  5:38 ` [alsa-devel] [PATCH 03/14] ASoC: soc-core: remove snd_soc_get_dai_substream() Kuninori Morimoto
2019-11-22  5:39 ` [alsa-devel] [PATCH 04/14] ASoC: soc-core: move snd_soc_get_pcm_runtime() Kuninori Morimoto
2019-11-22 16:22   ` Pierre-Louis Bossart
2019-11-22 16:45   ` Pierre-Louis Bossart
2019-11-22  5:39 ` [alsa-devel] [PATCH 05/14] ASoC: soc-core: find rtd via dai_link pointer at snd_soc_get_pcm_runtime() Kuninori Morimoto
2019-11-22  5:39 ` [alsa-devel] [PATCH 06/14] ASoC: soc-core: move snd_soc_find_dai_link() Kuninori Morimoto
2019-11-22  5:40 ` [alsa-devel] [PATCH 07/14] ASoC: soc-core: rename snd_soc_add_dai_link() to snd_soc_add_pcm_runtime() Kuninori Morimoto
2019-11-22 16:43   ` Pierre-Louis Bossart
2019-11-22  5:41 ` [alsa-devel] [PATCH 08/14] ASoC: soc-core: rename snd_soc_remove_dai_link() to snd_soc_remove_pcm_runtime() Kuninori Morimoto
2019-11-22  5:41 ` [alsa-devel] [PATCH 09/14] ASoC: soc-core: move soc_link_dai_pcm_new() Kuninori Morimoto
2019-11-22  5:41 ` [alsa-devel] [PATCH 10/14] ASoC: soc-core: rename soc_link_dai_pcm_new() to soc_dai_pcm_new() Kuninori Morimoto
2019-11-22  5:41 ` [alsa-devel] [PATCH 11/14] ASoC: soc-core: move soc_link_init() Kuninori Morimoto
2019-11-22  5:41 ` [alsa-devel] [PATCH 12/14] ASoC: soc-core: rename soc_link_init() to soc_init_pcm_runtime() Kuninori Morimoto
2019-11-22 16:41   ` Pierre-Louis Bossart
2019-11-22  5:42 ` [alsa-devel] [PATCH 13/14] ASoC: soc-core: soc_set_name_prefix(): tidyup loop condition Kuninori Morimoto
2019-11-22  5:42 ` [alsa-devel] [PATCH 14/14] ASoC: soc-core: soc_set_name_prefix(): get component device_node at out of loop Kuninori Morimoto
2019-11-22 16:49 ` [alsa-devel] [PATCH 00/14] ASoC: soc-core cleanup step6 Pierre-Louis Bossart
2019-11-25  0:01   ` Kuninori Morimoto
2019-11-22 20:34 ` Sridharan, Ranjani
2019-11-25  0:01   ` Kuninori Morimoto

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=87pnhk8o81.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /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).