History

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.

Cezary Rojewski committed 6 years ago

Commit 7274d4c1 parent 08ff7202 files · +9 −11Browse files

Unified · Split

2 files
  1. include/sound/soc.h +1 −1
  2. sound/soc/soc-core.c +8 −10
include/sound/soc.h+1−1
@@ -416,7 +416,7 @@ static inline int snd_soc_resume(struct device *dev) · 415 unmodified lines
416416 int snd_soc_poweroff(struct device *dev);
417417 int snd_soc_component_initialize(struct snd_soc_component *component,
418418 const struct snd_soc_component_driver *driver,
419− struct device *dev, const char *name);
419+ struct device *dev);
420420 int snd_soc_add_component(struct device *dev,
421421 struct snd_soc_component *component,
422422 const struct snd_soc_component_driver *component_driver,
sound/soc/soc-core.c+8−10
@@ -2440,14 +2440,19 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component) · 2439 unmodified lines
24402440
24412441 int snd_soc_component_initialize(struct snd_soc_component *component,
24422442 const struct snd_soc_component_driver *driver,
2443− struct device *dev, const char *name)
2443+ struct device *dev)
24442444 {
24452445 INIT_LIST_HEAD(&component->dai_list);
24462446 INIT_LIST_HEAD(&component->dobj_list);
24472447 INIT_LIST_HEAD(&component->card_list);
24482448 mutex_init(&component->io_mutex);
24492449
2450− component->name = name;
2450+ component->name = fmt_single_name(dev, &component->id);
2451+ if (!component->name) {
2452+ dev_err(dev, "ASoC: Failed to allocate name\n");
2453+ return -ENOMEM;
2454+ }
2455+
24512456 component->dev = dev;
24522457 component->driver = driver;
24532458
@@ -2461,19 +2466,12 @@ int snd_soc_add_component(struct device *dev, · 7 unmodified lines
24612466 struct snd_soc_dai_driver *dai_drv,
24622467 int num_dai)
24632468 {
2464− const char *name = fmt_single_name(dev, &component->id);
24652469 int ret;
24662470 int i;
24672471
2468− if (!name) {
2469− dev_err(dev, "ASoC: Failed to allocate name\n");
2470− return -ENOMEM;
2471− }
2472−
24732472 mutex_lock(&client_mutex);
24742473
2475− ret = snd_soc_component_initialize(component, component_driver,
2476− dev, name);
2474+ ret = snd_soc_component_initialize(component, component_driver, dev);
24772475 if (ret)
24782476 goto err_free;
24792477

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t