[alsa-devel] Question about soc_bind_dai_link()
Hi ALSA ML
I noticed a little bit strange operation on soc_bind_dai_link(). To research platform, it is using list_for_each_entry(). After finding platform, it sets rtd->platform, but it doesn't use "break". This means, rtd->platform might be overwrote. Is this on purpose ? or bug ?
static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) { ... /* find one from the set of registered platforms */ list_for_each_entry(platform, &platform_list, list) { platform_of_node = platform->dev->of_node; if (!platform_of_node && platform->dev->parent->of_node) platform_of_node = platform->dev->parent->of_node;
if (dai_link->platform_of_node) { if (platform_of_node != dai_link->platform_of_node) continue; } else { if (strcmp(platform->component.name, platform_name)) continue; }
=> rtd->platform = platform; } ... }
Best regards --- Kuninori Morimoto
On Ma, 2017-08-01 at 06:47 +0000, Kuninori Morimoto wrote:
Hi ALSA ML
I noticed a little bit strange operation on soc_bind_dai_link(). To research platform, it is using list_for_each_entry(). After finding platform, it sets rtd->platform, but it doesn't use "break". This means, rtd->platform might be overwrote. Is this on purpose ? or bug ?
static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) { ... /* find one from the set of registered platforms */ list_for_each_entry(platform, &platform_list, list) { platform_of_node = platform->dev->of_node; if (!platform_of_node && platform->dev->parent->of_node) platform_of_node = platform->dev->parent->of_node;
if (dai_link->platform_of_node) { if (platform_of_node != dai_link->platform_of_node) continue; } else { if (strcmp(platform->component.name, platform_name)) continue; }
=> rtd->platform = platform;
This isn't actually a bug because you reach here only if the given platform is found.
Anyhow, in the past the used to be a goto here. Things have changed with
commit b19e6e7b763c7144bfe2ceccf988b64d66d6dd0a Author: Mark Brown broonie@opensource.wolfsonmicro.com Date: Wed Mar 14 21:18:39 2012 +0000
ASoC: core: Use driver core probe deferral
thanks, Daniel.
Hi
static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) { ... /* find one from the set of registered platforms */ list_for_each_entry(platform, &platform_list, list) { platform_of_node = platform->dev->of_node; if (!platform_of_node && platform->dev->parent->of_node) platform_of_node = platform->dev->parent->of_node;
if (dai_link->platform_of_node) { if (platform_of_node != dai_link->platform_of_node) continue; } else { if (strcmp(platform->component.name, platform_name)) continue; }
=> rtd->platform = platform;
This isn't actually a bug because you reach here only if the given platform is found.
Thanks. Yes, any cases it is not a big deal. In my cases it reaches here only once, because my system registers 1 platform only. I don't know detail, but some board is registering 2 platforms (own platform and dmaengine ?) In such case, rtd->platform was overwrote ? It seems existing such board is working, thus this is not a big deal. Just question
Best regards --- Kuninori Morimoto
On Ma, 2017-08-01 at 08:47 +0000, Kuninori Morimoto wrote:
Hi
static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) { ... /* find one from the set of registered platforms */ list_for_each_entry(platform, &platform_list, list) { platform_of_node = platform->dev->of_node; if (!platform_of_node && platform->dev->parent->of_node) platform_of_node = platform->dev->parent->of_node;
if (dai_link->platform_of_node) { if (platform_of_node != dai_link->platform_of_node) continue; } else { if (strcmp(platform->component.name, platform_name)) continue; }
=> rtd->platform = platform;
This isn't actually a bug because you reach here only if the given platform is found.
Thanks. Yes, any cases it is not a big deal. In my cases it reaches here only once, because my system registers 1 platform only. I don't know detail, but some board is registering 2 platforms (own platform and dmaengine ?) In such case, rtd->platform was overwrote ?
No, because we only do the assignment rtd->platform = platform if
platform_of_node == dai_link->platform_of_node OR platform->name == platform_name.
In case we are registering 2 platforms (like you said: own platform and dmaengine) they will be having different names/of_nodes.
It seems existing such board is working, thus this is not a big deal. Just question
Hi Daniel
static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) { ... /* find one from the set of registered platforms */ list_for_each_entry(platform, &platform_list, list) { platform_of_node = platform->dev->of_node; if (!platform_of_node && platform->dev->parent->of_node) platform_of_node = platform->dev->parent->of_node;
if (dai_link->platform_of_node) { if (platform_of_node != dai_link->platform_of_node) continue; } else { if (strcmp(platform->component.name, platform_name)) continue; }
=> rtd->platform = platform;
This isn't actually a bug because you reach here only if the given platform is found.
Thanks. Yes, any cases it is not a big deal. In my cases it reaches here only once, because my system registers 1 platform only. I don't know detail, but some board is registering 2 platforms (own platform and dmaengine ?) In such case, rtd->platform was overwrote ?
No, because we only do the assignment rtd->platform = platform if
platform_of_node == dai_link->platform_of_node OR platform->name == platform_name.
In case we are registering 2 platforms (like you said: own platform and dmaengine) they will be having different names/of_nodes.
I can't find concrete driver now, but I found the driver which "own platform" and "dmaengine platform" are using same "dev". Because of this, I confused about this.
Best regards --- Kuninori Morimoto
On Tue, Aug 01, 2017 at 09:38:34AM +0000, Kuninori Morimoto wrote:
No, because we only do the assignment rtd->platform = platform if platform_of_node == dai_link->platform_of_node OR platform->name == platform_name.
In case we are registering 2 platforms (like you said: own platform and dmaengine) they will be having different names/of_nodes.
I can't find concrete driver now, but I found the driver which "own platform" and "dmaengine platform" are using same "dev". Because of this, I confused about this.
That doesn't ring any bells for me...
participants (3)
-
Daniel Baluta
-
Kuninori Morimoto
-
Mark Brown