summaryrefslogtreecommitdiff
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2020-06-04 17:07:54 +0900
committerMark Brown <broonie@kernel.org>2020-06-15 18:21:25 +0100
commit257c4dac8b7877c865e734533b5f62769c64afb6 (patch)
treea517cd2382890624ce43fa118a1175a5a95c59a5 /sound/soc/soc-core.c
parent32fd120475c1b8a83d28bfedc2b95ec981fbb809 (diff)
ASoC: soc-component: add snd_soc_component_init()
we wantn't to directly access to component related parameter as much as possible to keep encapsulation. This patch adds snd_soc_component_init() for it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/87img7w8x2.wl-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.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e596e5a765da..c38bb423e695 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1208,15 +1208,14 @@ static int soc_probe_component(struct snd_soc_card *card,
component->name);
probed = 1;
- /* machine specific init */
- if (component->init) {
- ret = component->init(component);
- if (ret < 0) {
- dev_err(component->dev,
- "Failed to do machine specific init %d\n", ret);
- goto err_probe;
- }
- }
+ /*
+ * machine specific init
+ * see
+ * snd_soc_component_set_aux()
+ */
+ ret = snd_soc_component_init(component);
+ if (ret < 0)
+ goto err_probe;
ret = snd_soc_add_component_controls(component,
component->driver->controls,
@@ -1330,7 +1329,8 @@ static void soc_unbind_aux_dev(struct snd_soc_card *card)
struct snd_soc_component *component, *_component;
for_each_card_auxs_safe(card, component, _component) {
- component->init = NULL;
+ /* for snd_soc_component_init() */
+ snd_soc_component_set_aux(component, NULL);
list_del(&component->card_aux_list);
}
}
@@ -1347,7 +1347,8 @@ static int soc_bind_aux_dev(struct snd_soc_card *card)
if (!component)
return -EPROBE_DEFER;
- component->init = aux->init;
+ /* for snd_soc_component_init() */
+ snd_soc_component_set_aux(component, aux);
/* see for_each_card_auxs */
list_add(&component->card_aux_list, &card->aux_comp_list);
}