mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-10 06:34:17 +08:00
ASoC: Make rtd->codec optional
There are some place in the ASoC core that expect rtd->codec to be non NULL (mainly CODEC specific sysfs files). With componentization going forward rtd->codec might be NULL in some cases. This patch prepares the core for this by not registering CODEC specific sysfs files if rtd->codec is NULL. sysfs file removal does not need to be conditionalized as it handles the removal of non-existing files just fine. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
f1d45cc3ae
commit
93c3ce76cc
@ -1261,17 +1261,21 @@ static int soc_post_component_init(struct snd_soc_pcm_runtime *rtd,
|
|||||||
}
|
}
|
||||||
rtd->dev_registered = 1;
|
rtd->dev_registered = 1;
|
||||||
|
|
||||||
/* add DAPM sysfs entries for this codec */
|
if (rtd->codec) {
|
||||||
ret = snd_soc_dapm_sys_add(rtd->dev);
|
/* add DAPM sysfs entries for this codec */
|
||||||
if (ret < 0)
|
ret = snd_soc_dapm_sys_add(rtd->dev);
|
||||||
dev_err(rtd->dev,
|
if (ret < 0)
|
||||||
"ASoC: failed to add codec dapm sysfs entries: %d\n", ret);
|
dev_err(rtd->dev,
|
||||||
|
"ASoC: failed to add codec dapm sysfs entries: %d\n",
|
||||||
|
ret);
|
||||||
|
|
||||||
/* add codec sysfs entries */
|
/* add codec sysfs entries */
|
||||||
ret = device_create_file(rtd->dev, &dev_attr_codec_reg);
|
ret = device_create_file(rtd->dev, &dev_attr_codec_reg);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
dev_err(rtd->dev,
|
dev_err(rtd->dev,
|
||||||
"ASoC: failed to add codec sysfs files: %d\n", ret);
|
"ASoC: failed to add codec sysfs files: %d\n",
|
||||||
|
ret);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user