ASoC: soc-core: Fix regression causing sysfs entries to disappear

The allocation order of things in soc_new_pcm_runtime was changed to
move the device_register before the allocation of the rtd structure.
This was to allow the rtd allocation to be managed by devm. However
currently the sysfs entries are added by device_register and their
visibility depends on variables within the rtd structure, this causes
the pmdown_time and dapm_widgets sysfs entries to be missing for all
rtds.

Correct this issue by manually calling device_add_groups after the
appropriate information is available.

Fixes: d918a37610 ("ASoC: soc-core: tidyup soc_new_pcm_runtime() alloc order")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200730120715.637-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Charles Keepax 2020-07-30 13:07:14 +01:00 committed by Mark Brown
parent dc5fb6d2e8
commit 5c74c9d34a
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 4 additions and 1 deletions

View File

@ -446,7 +446,6 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
dev->parent = card->dev;
dev->release = soc_release_rtd_dev;
dev->groups = soc_dev_attr_groups;
dev_set_name(dev, "%s", dai_link->name);
@ -503,6 +502,10 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
/* see for_each_card_rtds */
list_add_tail(&rtd->list, &card->rtd_list);
ret = device_add_groups(dev, soc_dev_attr_groups);
if (ret < 0)
goto free_rtd;
return rtd;
free_rtd: