summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2018-02-14 02:58:03 +0000
committerMark Brown <broonie@kernel.org>2018-02-14 11:57:26 +0000
commit7a2ccad58106696b7909815cc7ab359ae2743bcc (patch)
treefaecb646a1fff2aa530ec9e7248df38cf415ea13 /sound
parent6b49087912e311bc884d36874592595508630b88 (diff)
downloadlwn-7a2ccad58106696b7909815cc7ab359ae2743bcc.tar.gz
lwn-7a2ccad58106696b7909815cc7ab359ae2743bcc.zip
ASoC: soc-core: soc_probe_dai() code simplification
Current soc_probe_dai() is using deep nested condition. Thus, it is difficult to read/understand. This patch simplification it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-core.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 60a542f35dbd..574048a73b1c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1624,22 +1624,21 @@ static int soc_probe_link_components(struct snd_soc_card *card,
static int soc_probe_dai(struct snd_soc_dai *dai, int order)
{
- int ret;
+ if (dai->probed ||
+ dai->driver->probe_order != order)
+ return 0;
- if (!dai->probed && dai->driver->probe_order == order) {
- if (dai->driver->probe) {
- ret = dai->driver->probe(dai);
- if (ret < 0) {
- dev_err(dai->dev,
- "ASoC: failed to probe DAI %s: %d\n",
- dai->name, ret);
- return ret;
- }
+ if (dai->driver->probe) {
+ int ret = dai->driver->probe(dai);
+ if (ret < 0) {
+ dev_err(dai->dev, "ASoC: failed to probe DAI %s: %d\n",
+ dai->name, ret);
+ return ret;
}
-
- dai->probed = 1;
}
+ dai->probed = 1;
+
return 0;
}