aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorHarsha Priya <priya.harsha@intel.com>2011-01-05 01:04:51 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-01-05 06:29:00 -0500
commitf6c2ed5dd6ab43447dacc136585fc894e3f3a82d (patch)
tree5738b81956b7544495ffe9b7e9f6308d590bf7c7 /sound
parent5e79d64b038ae0039663f721f4b9f5ce1951d9da (diff)
ASoC: Fix the device references to codec and platform drivers
The soc-core takes the platform and codec driver reference during probe. Few of these references are not released during remove. This cause the platform and codec driver module unload to fail. This patch fixes by the taking only one reference to platform and codec module during probe and releases them correctly during remove. This allows load/unload properly Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Harsha Priya <priya.harsha@intel.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-core.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index a233607a73c6..bac7291b6ff6 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1259,9 +1259,6 @@ find_codec:
1259 if (!strcmp(codec->name, dai_link->codec_name)) { 1259 if (!strcmp(codec->name, dai_link->codec_name)) {
1260 rtd->codec = codec; 1260 rtd->codec = codec;
1261 1261
1262 if (!try_module_get(codec->dev->driver->owner))
1263 return -ENODEV;
1264
1265 /* CODEC found, so find CODEC DAI from registered DAIs from this CODEC*/ 1262 /* CODEC found, so find CODEC DAI from registered DAIs from this CODEC*/
1266 list_for_each_entry(codec_dai, &dai_list, list) { 1263 list_for_each_entry(codec_dai, &dai_list, list) {
1267 if (codec->dev == codec_dai->dev && 1264 if (codec->dev == codec_dai->dev &&
@@ -1287,10 +1284,6 @@ find_platform:
1287 /* no, then find CPU DAI from registered DAIs*/ 1284 /* no, then find CPU DAI from registered DAIs*/
1288 list_for_each_entry(platform, &platform_list, list) { 1285 list_for_each_entry(platform, &platform_list, list) {
1289 if (!strcmp(platform->name, dai_link->platform_name)) { 1286 if (!strcmp(platform->name, dai_link->platform_name)) {
1290
1291 if (!try_module_get(platform->dev->driver->owner))
1292 return -ENODEV;
1293
1294 rtd->platform = platform; 1287 rtd->platform = platform;
1295 goto out; 1288 goto out;
1296 } 1289 }
@@ -1425,6 +1418,9 @@ static int soc_probe_codec(struct snd_soc_card *card,
1425 soc_init_codec_debugfs(codec); 1418 soc_init_codec_debugfs(codec);
1426 1419
1427 /* mark codec as probed and add to card codec list */ 1420 /* mark codec as probed and add to card codec list */
1421 if (!try_module_get(codec->dev->driver->owner))
1422 return -ENODEV;
1423
1428 codec->probed = 1; 1424 codec->probed = 1;
1429 list_add(&codec->card_list, &card->codec_dev_list); 1425 list_add(&codec->card_list, &card->codec_dev_list);
1430 list_add(&codec->dapm.list, &card->dapm_list); 1426 list_add(&codec->dapm.list, &card->dapm_list);
@@ -1556,6 +1552,10 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num)
1556 } 1552 }
1557 } 1553 }
1558 /* mark platform as probed and add to card platform list */ 1554 /* mark platform as probed and add to card platform list */
1555
1556 if (!try_module_get(platform->dev->driver->owner))
1557 return -ENODEV;
1558
1559 platform->probed = 1; 1559 platform->probed = 1;
1560 list_add(&platform->card_list, &card->platform_dev_list); 1560 list_add(&platform->card_list, &card->platform_dev_list);
1561 } 1561 }