summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorKuninori Morimoto2019-06-20 02:49:23 +0200
committerMark Brown2019-06-24 18:23:19 +0200
commita9ec84966f6d887b9066029596eb361b5d2af214 (patch)
tree34af5a3d41dd2a7405dbd3eb807069b830a7fdbb /sound/soc/soc-core.c
parentASoC: soc-core: move soc_find_component() (diff)
downloadkernel-qcow2-linux-a9ec84966f6d887b9066029596eb361b5d2af214.tar.gz
kernel-qcow2-linux-a9ec84966f6d887b9066029596eb361b5d2af214.tar.xz
kernel-qcow2-linux-a9ec84966f6d887b9066029596eb361b5d2af214.zip
ASoC: soc-core: soc_find_component() uses snd_soc_is_matching_component()
ALSA SoC already has snd_soc_is_matching_component() to confirming matching component, but, soc_find_component() has original implementation to confirm component. We shouldn't have duplicate implementation to do same things. This patch uses snd_soc_is_matching_component() at soc_find_component() Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 1b94119cfb0d..e6b95b7e2737 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -780,22 +780,18 @@ static int snd_soc_is_matching_component(
}
static struct snd_soc_component *soc_find_component(
- const struct device_node *of_node, const char *name)
+ struct device_node *of_node, const char *name)
{
struct snd_soc_component *component;
- struct device_node *component_of_node;
+ struct snd_soc_dai_link_component dlc;
lockdep_assert_held(&client_mutex);
for_each_component(component) {
- if (of_node) {
- component_of_node = soc_component_to_node(component);
-
- if (component_of_node == of_node)
- return component;
- } else if (name && strcmp(component->name, name) == 0) {
+ dlc.name = name;
+ dlc.of_node = of_node;
+ if (snd_soc_is_matching_component(&dlc, component))
return component;
- }
}
return NULL;