From: Marco Felsch <m.felsch@pengutronix.de>
To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com,
nicoleotsuka@gmail.com, lgirdwood@gmail.com, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org,
kernel@pengutronix.de
Subject: [PATCH 2/3] ASoC: fsl_sai: convert to dev_err_probe
Date: Wed, 1 Jun 2022 11:23:41 +0200 [thread overview]
Message-ID: <20220601092342.3328644-2-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20220601092342.3328644-1-m.felsch@pengutronix.de>
Make use of the new macro to get device defered information for free
and to cleanup the code a bit. No functional changes.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
sound/soc/fsl/fsl_sai.c | 33 +++++++++++----------------------
1 file changed, 11 insertions(+), 22 deletions(-)
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index a7637d602f3c..3e54f1f71c1e 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -1034,21 +1034,15 @@ static int fsl_sai_probe(struct platform_device *pdev)
}
sai->regmap = devm_regmap_init_mmio(dev, base, &fsl_sai_regmap_config);
- if (IS_ERR(sai->regmap)) {
- dev_err(dev, "regmap init failed\n");
- return PTR_ERR(sai->regmap);
- }
+ if (IS_ERR(sai->regmap))
+ return dev_err_probe(dev, PTR_ERR(sai->regmap), "regmap init failed\n");
sai->bus_clk = devm_clk_get(dev, "bus");
/* Compatible with old DTB cases */
if (IS_ERR(sai->bus_clk) && PTR_ERR(sai->bus_clk) != -EPROBE_DEFER)
sai->bus_clk = devm_clk_get(dev, "sai");
- if (IS_ERR(sai->bus_clk)) {
- dev_err(dev, "failed to get bus clock: %ld\n",
- PTR_ERR(sai->bus_clk));
- /* -EPROBE_DEFER */
- return PTR_ERR(sai->bus_clk);
- }
+ if (IS_ERR(sai->bus_clk))
+ return dev_err_probe(dev, PTR_ERR(sai->bus_clk), "failed to get bus clock\n");
for (i = 1; i < FSL_SAI_MCLK_MAX; i++) {
sprintf(tmp, "mclk%d", i);
@@ -1067,14 +1061,12 @@ static int fsl_sai_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
if (irq < 0)
- return irq;
+ return dev_err_probe(dev, irq, "failed to get the irq\n");
ret = devm_request_irq(dev, irq, fsl_sai_isr, IRQF_SHARED,
np->name, sai);
- if (ret) {
- dev_err(dev, "failed to claim irq %u\n", irq);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to claim irq %u\n", irq);
memcpy(&sai->cpu_dai_drv, &fsl_sai_dai_template,
sizeof(fsl_sai_dai_template));
@@ -1089,8 +1081,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
if (of_find_property(np, "fsl,sai-synchronous-rx", NULL) &&
of_find_property(np, "fsl,sai-asynchronous", NULL)) {
/* error out if both synchronous and asynchronous are present */
- dev_err(dev, "invalid binding for synchronous mode\n");
- return -EINVAL;
+ return dev_err_probe(dev, -EINVAL, "invalid binding for synchronous mode\n");
}
if (of_find_property(np, "fsl,sai-synchronous-rx", NULL)) {
@@ -1109,14 +1100,12 @@ static int fsl_sai_probe(struct platform_device *pdev)
if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) &&
of_device_is_compatible(np, "fsl,imx6ul-sai")) {
gpr = syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");
- if (IS_ERR(gpr)) {
- dev_err(dev, "cannot find iomuxc registers\n");
- return PTR_ERR(gpr);
- }
+ if (IS_ERR(gpr))
+ return dev_err_probe(dev, PTR_ERR(gpr), "cannot find iomuxc registers\n");
index = of_alias_get_id(np, "sai");
if (index < 0)
- return index;
+ return dev_err_probe(dev, index, "cannot find sai aliases\n");
regmap_update_bits(gpr, IOMUXC_GPR1, MCLK_DIR(index),
MCLK_DIR(index));
--
2.30.2
next prev parent reply other threads:[~2022-06-01 9:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-01 9:23 [PATCH 1/3] ASoC: fsl_sai: use local device pointer Marco Felsch
2022-06-01 9:23 ` Marco Felsch [this message]
2022-06-06 2:48 ` [PATCH 2/3] ASoC: fsl_sai: convert to dev_err_probe Shengjiu Wang
2022-06-01 9:23 ` [PATCH 3/3] ASoC: fsl_sai: add error message in case of missing imx-pcm-dma support Marco Felsch
2022-06-06 3:20 ` Shengjiu Wang
2022-06-06 3:18 ` [PATCH 1/3] ASoC: fsl_sai: use local device pointer Shengjiu Wang
2022-06-07 10:46 ` (subset) " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220601092342.3328644-2-m.felsch@pengutronix.de \
--to=m.felsch@pengutronix.de \
--cc=Xiubo.Lee@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=lgirdwood@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nicoleotsuka@gmail.com \
--cc=shengjiu.wang@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).