ASoC: soc-component: move snd_soc_add_component_controls()

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 <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
Link: https://patch.msgid.link/87ld81yolw.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2026-10-14 02:58:51 +00:00 committed by Mark Brown
parent 0ce431a9fc
commit ed2c53c841
No known key found for this signature in database
GPG Key ID: 2FEF73B0B3D03889
4 changed files with 25 additions and 21 deletions

View File

@ -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) \

View File

@ -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

View File

@ -12,6 +12,7 @@
#include <linux/pm_runtime.h>
#include <sound/soc.h>
#include <linux/bitops.h>
#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;

View File

@ -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.