Blob Blame History Raw
From a33c0d166cc5bcb3b9718649b84974216709acb1 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Tue, 20 Aug 2019 14:05:02 +0900
Subject: [PATCH] ASoC: soc-core: add NOTE to snd_soc_rtdcom_lookup()
Git-commit: a33c0d166cc5bcb3b9718649b84974216709acb1
Patch-mainline: v5.4-rc1
References: jsc#SLE-16518

We can find specified name component via snd_soc_rtdcom_lookup().
But, it is not enough under multi CPU/Codec/Platform, because many
components which have same driver name might be connected to same rtd.

Not using this function as much as possible is best solution,
but some drivers are already deeply depended to it.

We can expand this function, for example having "num" which specifies
found order at parameter, etc (In such case, it need to have fixed
probing order).
Or, use different driver name in such component, etc.

We will have such issue if multi CPU/Codec/Platform were supported.
To indicate it, this patch adds NOTE to this function.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/874l2c1ldi.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 sound/soc/soc-core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3860d8521734..0ed6576bfef4 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -315,6 +315,14 @@ struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd,
 	if (!driver_name)
 		return NULL;
 
+	/*
+	 * NOTE
+	 *
+	 * snd_soc_rtdcom_lookup() will find component from rtd by using
+	 * specified driver name.
+	 * But, if many components which have same driver name are connected
+	 * to 1 rtd, this function will return 1st found component.
+	 */
 	for_each_rtdcom(rtd, rtdcom) {
 		const char *component_name = rtdcom->component->driver->name;
 
-- 
2.16.4