diff options
author | Jarkko Nikula <jhnikula@gmail.com> | 2011-01-27 09:24:22 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-01-28 07:58:14 -0500 |
commit | 70d29331ac551c11e6e3934f43a548ae8154351e (patch) | |
tree | 05cccb4bbe9a906943cdb762bcead5554a0355c5 /sound | |
parent | 8c9daae2cfe3b17f946ff998a692bddc9cd3e3b6 (diff) |
ASoC: soc-core: Increment codec and platform driver refcounts before probing
Commit f6c2ed5 "ASoC: Fix the device references to codec and platform drivers"
moved codec and platform driver refcount increments from soc_bind_dai_link
to more appropriate places.
Adjust a little them so that refcounts are incremented before executing the
driver probe functions.
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Harsha Priya <priya.harsha@intel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-core.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e9f81c551e5e..9dfbb8fcb765 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1412,26 +1412,31 @@ static int soc_probe_codec(struct snd_soc_card *card, | |||
1412 | codec->dapm.card = card; | 1412 | codec->dapm.card = card; |
1413 | soc_set_name_prefix(card, codec); | 1413 | soc_set_name_prefix(card, codec); |
1414 | 1414 | ||
1415 | if (!try_module_get(codec->dev->driver->owner)) | ||
1416 | return -ENODEV; | ||
1417 | |||
1415 | if (codec->driver->probe) { | 1418 | if (codec->driver->probe) { |
1416 | ret = codec->driver->probe(codec); | 1419 | ret = codec->driver->probe(codec); |
1417 | if (ret < 0) { | 1420 | if (ret < 0) { |
1418 | dev_err(codec->dev, | 1421 | dev_err(codec->dev, |
1419 | "asoc: failed to probe CODEC %s: %d\n", | 1422 | "asoc: failed to probe CODEC %s: %d\n", |
1420 | codec->name, ret); | 1423 | codec->name, ret); |
1421 | return ret; | 1424 | goto err_probe; |
1422 | } | 1425 | } |
1423 | } | 1426 | } |
1424 | 1427 | ||
1425 | soc_init_codec_debugfs(codec); | 1428 | soc_init_codec_debugfs(codec); |
1426 | 1429 | ||
1427 | /* mark codec as probed and add to card codec list */ | 1430 | /* mark codec as probed and add to card codec list */ |
1428 | if (!try_module_get(codec->dev->driver->owner)) | ||
1429 | return -ENODEV; | ||
1430 | |||
1431 | codec->probed = 1; | 1431 | codec->probed = 1; |
1432 | list_add(&codec->card_list, &card->codec_dev_list); | 1432 | list_add(&codec->card_list, &card->codec_dev_list); |
1433 | list_add(&codec->dapm.list, &card->dapm_list); | 1433 | list_add(&codec->dapm.list, &card->dapm_list); |
1434 | 1434 | ||
1435 | return 0; | ||
1436 | |||
1437 | err_probe: | ||
1438 | module_put(codec->dev->driver->owner); | ||
1439 | |||
1435 | return ret; | 1440 | return ret; |
1436 | } | 1441 | } |
1437 | 1442 | ||
@@ -1549,19 +1554,19 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num) | |||
1549 | 1554 | ||
1550 | /* probe the platform */ | 1555 | /* probe the platform */ |
1551 | if (!platform->probed) { | 1556 | if (!platform->probed) { |
1557 | if (!try_module_get(platform->dev->driver->owner)) | ||
1558 | return -ENODEV; | ||
1559 | |||
1552 | if (platform->driver->probe) { | 1560 | if (platform->driver->probe) { |
1553 | ret = platform->driver->probe(platform); | 1561 | ret = platform->driver->probe(platform); |
1554 | if (ret < 0) { | 1562 | if (ret < 0) { |
1555 | printk(KERN_ERR "asoc: failed to probe platform %s\n", | 1563 | printk(KERN_ERR "asoc: failed to probe platform %s\n", |
1556 | platform->name); | 1564 | platform->name); |
1565 | module_put(platform->dev->driver->owner); | ||
1557 | return ret; | 1566 | return ret; |
1558 | } | 1567 | } |
1559 | } | 1568 | } |
1560 | /* mark platform as probed and add to card platform list */ | 1569 | /* mark platform as probed and add to card platform list */ |
1561 | |||
1562 | if (!try_module_get(platform->dev->driver->owner)) | ||
1563 | return -ENODEV; | ||
1564 | |||
1565 | platform->probed = 1; | 1570 | platform->probed = 1; |
1566 | list_add(&platform->card_list, &card->platform_dev_list); | 1571 | list_add(&platform->card_list, &card->platform_dev_list); |
1567 | } | 1572 | } |