Skip to contentSkip to conversation

ASoC: soc-core: export function to find components

PATCH In review [email protected] 3 participants 3 messages Jun 18, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: soc-core: export function to find components

From: Banajit Goswami <[email protected]>

Drivers may need to use the ASoC core function to find out whether a particular component is already registered with ASoC core or not.
Export the function so that drivers can use it outside of the file.

---
 include/sound/soc.h  |  2 ++
 sound/soc/soc-core.c | 13 ++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
include/sound/soc.h +2 -0
index 482b4ea..def975f 100644
@@ -1405,6 +1405,8 @@ int snd_soc_component_update_bits_async(struct snd_soc_component *component,
 void snd_soc_component_async_complete(struct snd_soc_component *component);
 int snd_soc_component_test_bits(struct snd_soc_component *component,
 	unsigned int reg, unsigned int mask, unsigned int value);
+struct snd_soc_component *soc_find_component(
+	const struct device_node *of_node, const char *name);
 
 /* component wide operations */
 int snd_soc_component_set_sysclk(struct snd_soc_component *component,
sound/soc/soc-core.c +12 -1
index 41c0cfa..50a9977 100644
@@ -741,7 +741,17 @@ int snd_soc_resume(struct device *dev)
 static const struct snd_soc_dai_ops null_dai_ops = {
 };
 
-static struct snd_soc_component *soc_find_component(
+/**
+ * soc_find_component: find a component from component_list in ASoC core
+ *
+ * @of_node: of_node of the component to query.
+ * @name: name of the component to query.
+ *
+ * function to find out if a component is already registered with ASoC core.
+ *
+ * Returns component handle for success, else NULL error.
+ */
+struct snd_soc_component *soc_find_component(
 	const struct device_node *of_node, const char *name)
 {
 	struct snd_soc_component *component;
@@ -764,6 +774,7 @@ static struct snd_soc_component *soc_find_component(
 
 	return NULL;
 }
+EXPORT_SYMBOL(soc_find_component);
 
 static int snd_soc_is_matching_component(
 	const struct snd_soc_dai_link_component *dlc,
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw
Quoted 52 lines · On Tue, 18 Jun 2019 09:47:38 +0200, [email protected] wrote:

From: Banajit Goswami <[email protected]>

Drivers may need to use the ASoC core function to find out whether a particular component is already registered with ASoC core or not.
Export the function so that drivers can use it outside of the file.

---
 include/sound/soc.h  |  2 ++
 sound/soc/soc-core.c | 13 ++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
include/sound/soc.h +2 -0
index 482b4ea..def975f 100644
@@ -1405,6 +1405,8 @@ int snd_soc_component_update_bits_async(struct snd_soc_component *component,
 void snd_soc_component_async_complete(struct snd_soc_component *component);
 int snd_soc_component_test_bits(struct snd_soc_component *component,
 	unsigned int reg, unsigned int mask, unsigned int value);
+struct snd_soc_component *soc_find_component(
+	const struct device_node *of_node, const char *name);
 
 /* component wide operations */
 int snd_soc_component_set_sysclk(struct snd_soc_component *component,
sound/soc/soc-core.c +11 -1
index 41c0cfa..50a9977 100644
@@ -741,7 +741,17 @@ int snd_soc_resume(struct device *dev)
 static const struct snd_soc_dai_ops null_dai_ops = {
 };
 
-static struct snd_soc_component *soc_find_component(
+/**
+ * soc_find_component: find a component from component_list in ASoC core
+ *
+ * @of_node: of_node of the component to query.
+ * @name: name of the component to query.
+ *
+ * function to find out if a component is already registered with ASoC core.
+ *
+ * Returns component handle for success, else NULL error.
+ */
+struct snd_soc_component *soc_find_component(
 	const struct device_node *of_node, const char *name)
 {
 	struct snd_soc_component *component;

sound/soc/soc-core.c static struct snd_soc_component *soc_find_component( · line 777

Quoted 4 lines
sound/soc/soc-core.c +1 -0
@@ -764,6 +774,7 @@ static struct snd_soc_component *soc_find_component(
 
 	return NULL;
 }
+EXPORT_SYMBOL(soc_find_component);

Why not EXPORT_SYMBOL_GPL()?

thanks,

Takashi

maintainer
#2 lore raw
Quoted 7 lines · Takashi Iwai
Quoted 5 lines · [email protected] wrote:

Drivers may need to use the ASoC core function to find out whether a particular component is already registered with ASoC core or not.
Export the function so that drivers can use it outside of the file.

Why might they need to do that?

Quoted 1 line

Why not EXPORT_SYMBOL_GPL()?

All the other ASoC exports are GPL, any new ones should be too.