summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorCezary Rojewski <cezary.rojewski@intel.com>2020-07-31 16:41:45 +0200
committerMark Brown <broonie@kernel.org>2020-07-31 19:35:58 +0100
commit7274d4cd8506bbff9bf2d7c2f73b2febff99abef (patch)
treef868fd83e7ffaef528f8b1d4daa9d4844712ab47 /sound
parent08ff7209faf21daa01bf66c91c321ce52d4b4bdb (diff)
ASoC: core: Simplify snd_soc_component_initialize declaration
Move 'name' field initialization responsibility back to snd_soc_component_initialize to prepare snd_soc_add_component function for being called separatelly as a second registration step. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20200731144146.6678-3-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-core.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 36eba1bb1ce1..d8155402c5e1 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2440,14 +2440,19 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component)
int snd_soc_component_initialize(struct snd_soc_component *component,
const struct snd_soc_component_driver *driver,
- struct device *dev, const char *name)
+ struct device *dev)
{
INIT_LIST_HEAD(&component->dai_list);
INIT_LIST_HEAD(&component->dobj_list);
INIT_LIST_HEAD(&component->card_list);
mutex_init(&component->io_mutex);
- component->name = name;
+ component->name = fmt_single_name(dev, &component->id);
+ if (!component->name) {
+ dev_err(dev, "ASoC: Failed to allocate name\n");
+ return -ENOMEM;
+ }
+
component->dev = dev;
component->driver = driver;
@@ -2461,19 +2466,12 @@ int snd_soc_add_component(struct device *dev,
struct snd_soc_dai_driver *dai_drv,
int num_dai)
{
- const char *name = fmt_single_name(dev, &component->id);
int ret;
int i;
- if (!name) {
- dev_err(dev, "ASoC: Failed to allocate name\n");
- return -ENOMEM;
- }
-
mutex_lock(&client_mutex);
- ret = snd_soc_component_initialize(component, component_driver,
- dev, name);
+ ret = snd_soc_component_initialize(component, component_driver, dev);
if (ret)
goto err_free;