diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-08-19 09:51:20 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-08-19 11:59:45 -0400 |
commit | 93c3ce76ccced3a8718149e8734ccaa931e9a1f1 (patch) | |
tree | dfb0ca9deaf504332fa512cbff8214c11bf0387c | |
parent | f1d45cc3ae96a6173129b2c164c216272faa5fc0 (diff) |
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>
-rw-r--r-- | sound/soc/soc-core.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b833cc6fd86d..1c705c28389c 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1261,17 +1261,21 @@ static int soc_post_component_init(struct snd_soc_pcm_runtime *rtd, | |||
1261 | } | 1261 | } |
1262 | rtd->dev_registered = 1; | 1262 | rtd->dev_registered = 1; |
1263 | 1263 | ||
1264 | /* add DAPM sysfs entries for this codec */ | 1264 | if (rtd->codec) { |
1265 | ret = snd_soc_dapm_sys_add(rtd->dev); | 1265 | /* add DAPM sysfs entries for this codec */ |
1266 | if (ret < 0) | 1266 | ret = snd_soc_dapm_sys_add(rtd->dev); |
1267 | dev_err(rtd->dev, | 1267 | if (ret < 0) |
1268 | "ASoC: failed to add codec dapm sysfs entries: %d\n", ret); | 1268 | dev_err(rtd->dev, |
1269 | "ASoC: failed to add codec dapm sysfs entries: %d\n", | ||
1270 | ret); | ||
1269 | 1271 | ||
1270 | /* add codec sysfs entries */ | 1272 | /* add codec sysfs entries */ |
1271 | ret = device_create_file(rtd->dev, &dev_attr_codec_reg); | 1273 | ret = device_create_file(rtd->dev, &dev_attr_codec_reg); |
1272 | if (ret < 0) | 1274 | if (ret < 0) |
1273 | dev_err(rtd->dev, | 1275 | dev_err(rtd->dev, |
1274 | "ASoC: failed to add codec sysfs files: %d\n", ret); | 1276 | "ASoC: failed to add codec sysfs files: %d\n", |
1277 | ret); | ||
1278 | } | ||
1275 | 1279 | ||
1276 | return 0; | 1280 | return 0; |
1277 | } | 1281 | } |