[PATCH 3/3] ASoC: soc-core: find platform by using snd_soc_find_component()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>

Now, all CPU/Codec/Platform had been converted to snd_soc_component
from each own structure.
By this conversion, calling snd_soc_rtdcom_add() is required to add
its component to rtd, and then, it added new component finding
operation for platform.

But this operation is very similar to finding DAI which is used for
CPU/Codec. More detail, it is snd_soc_find_dai() which finds DAI
from snd_soc_dai_link_component.

Now, we have snd_soc_find_component(), and platform is handled by
snd_soc_dai_link_component.
Let's use it, and be more simple code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
---
 sound/soc/soc-core.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c4a40dd..de324d9 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -858,7 +858,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
 	struct snd_soc_dai_link_component cpu_dai_component;
 	struct snd_soc_component *component;
 	struct snd_soc_dai **codec_dais;
-	struct device_node *platform_of_node;
 	int i;
 
 	if (dai_link->ignore)
@@ -905,22 +904,9 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
 	/* Single codec links expect codec and codec_dai in runtime data */
 	rtd->codec_dai = codec_dais[0];
 
-	/* find one from the set of registered platforms */
-	list_for_each_entry(component, &component_list, list) {
-		platform_of_node = component->dev->of_node;
-		if (!platform_of_node && component->dev->parent->of_node)
-			platform_of_node = component->dev->parent->of_node;
-
-		if (dai_link->platform->of_node) {
-			if (platform_of_node != dai_link->platform->of_node)
-				continue;
-		} else {
-			if (strcmp(component->name, dai_link->platform->name))
-				continue;
-		}
-
+	component = snd_soc_find_component(dai_link->platform);
+	if (component)
 		snd_soc_rtdcom_add(rtd, component);
-	}
 
 	soc_add_pcm_runtime(card, rtd);
 	return 0;
-- 
2.7.4

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



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux