* [PATCH][RFC] ASoC: soc-core: soc_probe_dai() code simplification
@ 2018-02-14 2:58 Kuninori Morimoto
2018-02-14 13:29 ` Applied "ASoC: soc-core: soc_probe_dai() code simplification" to the asoc tree Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Kuninori Morimoto @ 2018-02-14 2:58 UTC (permalink / raw)
To: Mark Brown; +Cc: Linux-ALSA
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
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>
---
sound/soc/soc-core.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9c65477..7687515 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1619,22 +1619,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;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Applied "ASoC: soc-core: soc_probe_dai() code simplification" to the asoc tree
2018-02-14 2:58 [PATCH][RFC] ASoC: soc-core: soc_probe_dai() code simplification Kuninori Morimoto
@ 2018-02-14 13:29 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2018-02-14 13:29 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: alsa-devel, Mark Brown
The patch
ASoC: soc-core: soc_probe_dai() code simplification
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From 7a2ccad58106696b7909815cc7ab359ae2743bcc Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 14 Feb 2018 02:58:03 +0000
Subject: [PATCH] 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>
---
sound/soc/soc-core.c | 23 +++++++++++------------
1 file 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;
}
--
2.16.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-14 13:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14 2:58 [PATCH][RFC] ASoC: soc-core: soc_probe_dai() code simplification Kuninori Morimoto
2018-02-14 13:29 ` Applied "ASoC: soc-core: soc_probe_dai() code simplification" to the asoc tree Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.