[PATCH v2 03/19] ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Thu May 28 03:47:56 CEST 2020


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 include/sound/soc-card.h |  3 +++
 include/sound/soc.h      |  2 --
 sound/soc/soc-card.c     | 16 ++++++++++++++++
 sound/soc/soc-core.c     | 16 ----------------
 4 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 997809bb3afb..c601eddf0975 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -8,4 +8,7 @@
 #ifndef __SOC_CARD_H
 #define __SOC_CARD_H
 
+struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
+					       const char *name);
+
 #endif /* __SOC_CARD_H */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 5b880e29d106..f93827c6be51 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -582,8 +582,6 @@ static inline int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops)
 struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
 				  void *data, const char *long_name,
 				  const char *prefix);
-struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
-					       const char *name);
 int snd_soc_add_component_controls(struct snd_soc_component *component,
 	const struct snd_kcontrol_new *controls, unsigned int num_controls);
 int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 4bc6f26ea8cb..340ab682cc76 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -24,3 +24,19 @@ static inline int _soc_card_ret(struct snd_soc_card *card,
 
 	return ret;
 }
+
+struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
+					       const char *name)
+{
+	struct snd_card *card = soc_card->snd_card;
+	struct snd_kcontrol *kctl;
+
+	if (unlikely(!name))
+		return NULL;
+
+	list_for_each_entry(kctl, &card->controls, list)
+		if (!strncmp(kctl->id.name, name, sizeof(kctl->id.name)))
+			return kctl;
+	return NULL;
+}
+EXPORT_SYMBOL_GPL(snd_soc_card_get_kcontrol);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e1b65059c0c4..b6105b92f589 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2096,22 +2096,6 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev,
 	return 0;
 }
 
-struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
-					       const char *name)
-{
-	struct snd_card *card = soc_card->snd_card;
-	struct snd_kcontrol *kctl;
-
-	if (unlikely(!name))
-		return NULL;
-
-	list_for_each_entry(kctl, &card->controls, list)
-		if (!strncmp(kctl->id.name, name, sizeof(kctl->id.name)))
-			return kctl;
-	return NULL;
-}
-EXPORT_SYMBOL_GPL(snd_soc_card_get_kcontrol);
-
 /**
  * snd_soc_add_component_controls - Add an array of controls to a component.
  *
-- 
2.17.1



More information about the Alsa-devel mailing list