diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-11-04 05:30:59 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-11-04 06:53:53 -0500 |
commit | 8e2be56273666614e24756d7ee551203b8a86809 (patch) | |
tree | 56754d59081cdf6b81f6818f9a3241bb3701dbdc | |
parent | 313665b983fe30af9d0eb274f7e03276e05a1bbf (diff) |
ASoC: Consolidate CPU and CODEC DAI probe
CPU and CODEC DAI probe are performed in exactly the same way. Which means
we can reuse the snd_soc_codec_dai_probe() for probing CPU DAIs as well.
While we are at it also drop the unused card parameter form the function.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/soc-core.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index f3216fc6d9f1..406925c2bbe7 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1241,25 +1241,22 @@ static int soc_probe_link_components(struct snd_soc_card *card, int num, | |||
1241 | return 0; | 1241 | return 0; |
1242 | } | 1242 | } |
1243 | 1243 | ||
1244 | static int soc_probe_codec_dai(struct snd_soc_card *card, | 1244 | static int soc_probe_dai(struct snd_soc_dai *dai, int order) |
1245 | struct snd_soc_dai *codec_dai, | ||
1246 | int order) | ||
1247 | { | 1245 | { |
1248 | int ret; | 1246 | int ret; |
1249 | 1247 | ||
1250 | if (!codec_dai->probed && codec_dai->driver->probe_order == order) { | 1248 | if (!dai->probed && dai->driver->probe_order == order) { |
1251 | if (codec_dai->driver->probe) { | 1249 | if (dai->driver->probe) { |
1252 | ret = codec_dai->driver->probe(codec_dai); | 1250 | ret = dai->driver->probe(dai); |
1253 | if (ret < 0) { | 1251 | if (ret < 0) { |
1254 | dev_err(codec_dai->dev, | 1252 | dev_err(dai->dev, |
1255 | "ASoC: failed to probe CODEC DAI %s: %d\n", | 1253 | "ASoC: failed to probe DAI %s: %d\n", |
1256 | codec_dai->name, ret); | 1254 | dai->name, ret); |
1257 | return ret; | 1255 | return ret; |
1258 | } | 1256 | } |
1259 | } | 1257 | } |
1260 | 1258 | ||
1261 | /* mark codec_dai as probed and add to card dai list */ | 1259 | dai->probed = 1; |
1262 | codec_dai->probed = 1; | ||
1263 | } | 1260 | } |
1264 | 1261 | ||
1265 | return 0; | 1262 | return 0; |
@@ -1318,24 +1315,13 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) | |||
1318 | /* set default power off timeout */ | 1315 | /* set default power off timeout */ |
1319 | rtd->pmdown_time = pmdown_time; | 1316 | rtd->pmdown_time = pmdown_time; |
1320 | 1317 | ||
1321 | /* probe the cpu_dai */ | 1318 | ret = soc_probe_dai(cpu_dai, order); |
1322 | if (!cpu_dai->probed && | 1319 | if (ret) |
1323 | cpu_dai->driver->probe_order == order) { | 1320 | return ret; |
1324 | if (cpu_dai->driver->probe) { | ||
1325 | ret = cpu_dai->driver->probe(cpu_dai); | ||
1326 | if (ret < 0) { | ||
1327 | dev_err(cpu_dai->dev, | ||
1328 | "ASoC: failed to probe CPU DAI %s: %d\n", | ||
1329 | cpu_dai->name, ret); | ||
1330 | return ret; | ||
1331 | } | ||
1332 | } | ||
1333 | cpu_dai->probed = 1; | ||
1334 | } | ||
1335 | 1321 | ||
1336 | /* probe the CODEC DAI */ | 1322 | /* probe the CODEC DAI */ |
1337 | for (i = 0; i < rtd->num_codecs; i++) { | 1323 | for (i = 0; i < rtd->num_codecs; i++) { |
1338 | ret = soc_probe_codec_dai(card, rtd->codec_dais[i], order); | 1324 | ret = soc_probe_dai(rtd->codec_dais[i], order); |
1339 | if (ret) | 1325 | if (ret) |
1340 | return ret; | 1326 | return ret; |
1341 | } | 1327 | } |