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>
This commit is contained in:
parent
313665b983
commit
8e2be56273
|
@ -1241,25 +1241,22 @@ static int soc_probe_link_components(struct snd_soc_card *card, int num,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int soc_probe_codec_dai(struct snd_soc_card *card,
|
static int soc_probe_dai(struct snd_soc_dai *dai, int order)
|
||||||
struct snd_soc_dai *codec_dai,
|
|
||||||
int order)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!codec_dai->probed && codec_dai->driver->probe_order == order) {
|
if (!dai->probed && dai->driver->probe_order == order) {
|
||||||
if (codec_dai->driver->probe) {
|
if (dai->driver->probe) {
|
||||||
ret = codec_dai->driver->probe(codec_dai);
|
ret = dai->driver->probe(dai);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(codec_dai->dev,
|
dev_err(dai->dev,
|
||||||
"ASoC: failed to probe CODEC DAI %s: %d\n",
|
"ASoC: failed to probe DAI %s: %d\n",
|
||||||
codec_dai->name, ret);
|
dai->name, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mark codec_dai as probed and add to card dai list */
|
dai->probed = 1;
|
||||||
codec_dai->probed = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1318,24 +1315,13 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
|
||||||
/* set default power off timeout */
|
/* set default power off timeout */
|
||||||
rtd->pmdown_time = pmdown_time;
|
rtd->pmdown_time = pmdown_time;
|
||||||
|
|
||||||
/* probe the cpu_dai */
|
ret = soc_probe_dai(cpu_dai, order);
|
||||||
if (!cpu_dai->probed &&
|
if (ret)
|
||||||
cpu_dai->driver->probe_order == order) {
|
return ret;
|
||||||
if (cpu_dai->driver->probe) {
|
|
||||||
ret = cpu_dai->driver->probe(cpu_dai);
|
|
||||||
if (ret < 0) {
|
|
||||||
dev_err(cpu_dai->dev,
|
|
||||||
"ASoC: failed to probe CPU DAI %s: %d\n",
|
|
||||||
cpu_dai->name, ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cpu_dai->probed = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* probe the CODEC DAI */
|
/* probe the CODEC DAI */
|
||||||
for (i = 0; i < rtd->num_codecs; i++) {
|
for (i = 0; i < rtd->num_codecs; i++) {
|
||||||
ret = soc_probe_codec_dai(card, rtd->codec_dais[i], order);
|
ret = soc_probe_dai(rtd->codec_dais[i], order);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue