From ed2c53c841fe2390e60f52d5a95c815d7b5c37f5 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 14 Oct 2026 02:58:51 +0000 Subject: [PATCH] ASoC: soc-component: move snd_soc_add_component_controls() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit snd_soc_add_component_controls() is Component related function. And its parameter will be capsuled soon, will be not enable to access from soc-core.c. Move it to soc-component.c It renames function name - snd_soc_add_component_controls() + snd_soc_component_add_controls() Signed-off-by: Kuninori Morimoto Reviewed-by: Alvin Šipraga Link: https://patch.msgid.link/87ld81yolw.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc-component.h | 3 +++ include/sound/soc.h | 3 +-- sound/soc/soc-component.c | 21 +++++++++++++++++++++ sound/soc/soc-core.c | 19 ------------------- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index 149c4d4f9403..b19abc5c2633 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -358,6 +358,9 @@ void snd_soc_component_init_regmap(struct snd_soc_component *component, void snd_soc_component_exit_regmap(struct snd_soc_component *component); #endif +int snd_soc_component_add_controls(struct snd_soc_component *component, + const struct snd_kcontrol_new *controls, unsigned int num_controls); + #define snd_soc_component_module_get_when_probe(component)\ snd_soc_component_module_get(component, NULL, 0) #define snd_soc_component_module_get_when_open(component, substream) \ diff --git a/include/sound/soc.h b/include/sound/soc.h index 08fdee15dba7..89612ac0c1d9 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -545,8 +545,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); -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, const struct snd_kcontrol_new *controls, int num_controls); int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, @@ -1542,5 +1540,6 @@ static inline void _snd_soc_dpcm_mutex_assert_held_r(struct snd_soc_pcm_runtime #define snd_soc_add_dai_controls snd_soc_dai_add_controls #define snd_soc_register_dai snd_soc_dai_register #define snd_soc_unregister_dai snd_soc_dai_unregister +#define snd_soc_add_component_controls snd_soc_component_add_controls #endif diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c index 34efb270ce29..5a9b526676f4 100644 --- a/sound/soc/soc-component.c +++ b/sound/soc/soc-component.c @@ -12,6 +12,7 @@ #include #include #include +#include "soc-internal.h" #define soc_component_ret(dai, ret) _soc_component_ret(dai, __func__, ret) static inline int _soc_component_ret(struct snd_soc_component *component, const char *func, int ret) @@ -320,6 +321,26 @@ int snd_soc_component_probe(struct snd_soc_component *component) return soc_component_ret(component, ret); } +/** + * snd_soc_component_add_controls - Add an array of controls to a component. + * + * @component: Component to add controls to + * @controls: Array of controls to add + * @num_controls: Number of elements in the array + * + * Return: 0 for success, else error. + */ +int snd_soc_component_add_controls(struct snd_soc_component *component, + const struct snd_kcontrol_new *controls, + unsigned int num_controls) +{ + struct snd_card *card = component->card->snd_card; + + return snd_soc_add_controls(card, component->dev, controls, + num_controls, component->name_prefix, component); +} +EXPORT_SYMBOL_GPL(snd_soc_component_add_controls); + int snd_soc_component_fixup_controls(struct snd_soc_component *component) { int ret = 0; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 69181cc0258b..06f001baf247 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2305,25 +2305,6 @@ int snd_soc_add_controls(struct snd_card *card, struct device *dev, return 0; } -/** - * snd_soc_add_component_controls - Add an array of controls to a component. - * - * @component: Component to add controls to - * @controls: Array of controls to add - * @num_controls: Number of elements in the array - * - * Return: 0 for success, else error. - */ -int snd_soc_add_component_controls(struct snd_soc_component *component, - const struct snd_kcontrol_new *controls, unsigned int num_controls) -{ - struct snd_card *card = component->card->snd_card; - - return snd_soc_add_controls(card, component->dev, controls, - num_controls, component->name_prefix, component); -} -EXPORT_SYMBOL_GPL(snd_soc_add_component_controls); - /** * snd_soc_add_card_controls - add an array of controls to a SoC card. * Convenience function to add a list of controls.