2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00

ASoC: soc-core: tidyup snd_soc_lookup_component_nolocked()

snd_soc_lookup_component_nolocked() is very complex today.
Let's tidyup the code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Message-ID: <87cy8sysuy.wl-kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2025-08-19 01:59:01 +00:00 committed by Mark Brown
parent 168873ca17
commit b833b412a5
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -369,21 +369,25 @@ struct snd_soc_component
*snd_soc_lookup_component_nolocked(struct device *dev, const char *driver_name)
{
struct snd_soc_component *component;
struct snd_soc_component *found_component;
found_component = NULL;
for_each_component(component) {
if ((dev == component->dev) &&
(!driver_name ||
(component->driver->name &&
((component->driver->name == driver_name) ||
(strcmp(component->driver->name, driver_name) == 0))))) {
found_component = component;
break;
}
if (dev != component->dev)
continue;
if (!driver_name)
return component;
if (!component->driver->name)
continue;
if (component->driver->name == driver_name)
return component;
if (strcmp(component->driver->name, driver_name) == 0)
return component;
}
return found_component;
return NULL;
}
EXPORT_SYMBOL_GPL(snd_soc_lookup_component_nolocked);