Commit 2ff4e003 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: meson: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-17-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent ef12f373
...@@ -218,34 +218,23 @@ static int aiu_clk_get(struct device *dev) ...@@ -218,34 +218,23 @@ static int aiu_clk_get(struct device *dev)
int ret; int ret;
aiu->pclk = devm_clk_get(dev, "pclk"); aiu->pclk = devm_clk_get(dev, "pclk");
if (IS_ERR(aiu->pclk)) { if (IS_ERR(aiu->pclk))
if (PTR_ERR(aiu->pclk) != -EPROBE_DEFER) return dev_err_probe(dev, PTR_ERR(aiu->pclk), "Can't get the aiu pclk\n");
dev_err(dev, "Can't get the aiu pclk\n");
return PTR_ERR(aiu->pclk);
}
aiu->spdif_mclk = devm_clk_get(dev, "spdif_mclk"); aiu->spdif_mclk = devm_clk_get(dev, "spdif_mclk");
if (IS_ERR(aiu->spdif_mclk)) { if (IS_ERR(aiu->spdif_mclk))
if (PTR_ERR(aiu->spdif_mclk) != -EPROBE_DEFER) return dev_err_probe(dev, PTR_ERR(aiu->spdif_mclk),
dev_err(dev, "Can't get the aiu spdif master clock\n"); "Can't get the aiu spdif master clock\n");
return PTR_ERR(aiu->spdif_mclk);
}
ret = aiu_clk_bulk_get(dev, aiu_i2s_ids, ARRAY_SIZE(aiu_i2s_ids), ret = aiu_clk_bulk_get(dev, aiu_i2s_ids, ARRAY_SIZE(aiu_i2s_ids),
&aiu->i2s); &aiu->i2s);
if (ret) { if (ret)
if (ret != -EPROBE_DEFER) return dev_err_probe(dev, ret, "Can't get the i2s clocks\n");
dev_err(dev, "Can't get the i2s clocks\n");
return ret;
}
ret = aiu_clk_bulk_get(dev, aiu_spdif_ids, ARRAY_SIZE(aiu_spdif_ids), ret = aiu_clk_bulk_get(dev, aiu_spdif_ids, ARRAY_SIZE(aiu_spdif_ids),
&aiu->spdif); &aiu->spdif);
if (ret) { if (ret)
if (ret != -EPROBE_DEFER) return dev_err_probe(dev, ret, "Can't get the spdif clocks\n");
dev_err(dev, "Can't get the spdif clocks\n");
return ret;
}
ret = clk_prepare_enable(aiu->pclk); ret = clk_prepare_enable(aiu->pclk);
if (ret) { if (ret) {
...@@ -281,11 +270,8 @@ static int aiu_probe(struct platform_device *pdev) ...@@ -281,11 +270,8 @@ static int aiu_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, aiu); platform_set_drvdata(pdev, aiu);
ret = device_reset(dev); ret = device_reset(dev);
if (ret) { if (ret)
if (ret != -EPROBE_DEFER) return dev_err_probe(dev, ret, "Failed to reset device\n");
dev_err(dev, "Failed to reset device\n");
return ret;
}
regs = devm_platform_ioremap_resource(pdev, 0); regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(regs)) if (IS_ERR(regs))
......
...@@ -351,20 +351,12 @@ int axg_fifo_probe(struct platform_device *pdev) ...@@ -351,20 +351,12 @@ int axg_fifo_probe(struct platform_device *pdev)
} }
fifo->pclk = devm_clk_get(dev, NULL); fifo->pclk = devm_clk_get(dev, NULL);
if (IS_ERR(fifo->pclk)) { if (IS_ERR(fifo->pclk))
if (PTR_ERR(fifo->pclk) != -EPROBE_DEFER) return dev_err_probe(dev, PTR_ERR(fifo->pclk), "failed to get pclk\n");
dev_err(dev, "failed to get pclk: %ld\n",
PTR_ERR(fifo->pclk));
return PTR_ERR(fifo->pclk);
}
fifo->arb = devm_reset_control_get_exclusive(dev, NULL); fifo->arb = devm_reset_control_get_exclusive(dev, NULL);
if (IS_ERR(fifo->arb)) { if (IS_ERR(fifo->arb))
if (PTR_ERR(fifo->arb) != -EPROBE_DEFER) return dev_err_probe(dev, PTR_ERR(fifo->arb), "failed to get arb reset\n");
dev_err(dev, "failed to get arb reset: %ld\n",
PTR_ERR(fifo->arb));
return PTR_ERR(fifo->arb);
}
fifo->irq = of_irq_get(dev->of_node, 0); fifo->irq = of_irq_get(dev->of_node, 0);
if (fifo->irq <= 0) { if (fifo->irq <= 0) {
......
...@@ -586,7 +586,6 @@ static int axg_pdm_probe(struct platform_device *pdev) ...@@ -586,7 +586,6 @@ static int axg_pdm_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct axg_pdm *priv; struct axg_pdm *priv;
void __iomem *regs; void __iomem *regs;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
...@@ -611,28 +610,16 @@ static int axg_pdm_probe(struct platform_device *pdev) ...@@ -611,28 +610,16 @@ static int axg_pdm_probe(struct platform_device *pdev)
} }
priv->pclk = devm_clk_get(dev, "pclk"); priv->pclk = devm_clk_get(dev, "pclk");
if (IS_ERR(priv->pclk)) { if (IS_ERR(priv->pclk))
ret = PTR_ERR(priv->pclk); return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get pclk\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get pclk: %d\n", ret);
return ret;
}
priv->dclk = devm_clk_get(dev, "dclk"); priv->dclk = devm_clk_get(dev, "dclk");
if (IS_ERR(priv->dclk)) { if (IS_ERR(priv->dclk))
ret = PTR_ERR(priv->dclk); return dev_err_probe(dev, PTR_ERR(priv->dclk), "failed to get dclk\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get dclk: %d\n", ret);
return ret;
}
priv->sysclk = devm_clk_get(dev, "sysclk"); priv->sysclk = devm_clk_get(dev, "sysclk");
if (IS_ERR(priv->sysclk)) { if (IS_ERR(priv->sysclk))
ret = PTR_ERR(priv->sysclk); return dev_err_probe(dev, PTR_ERR(priv->sysclk), "failed to get dclk\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get dclk: %d\n", ret);
return ret;
}
return devm_snd_soc_register_component(dev, &axg_pdm_component_drv, return devm_snd_soc_register_component(dev, &axg_pdm_component_drv,
&axg_pdm_dai_drv, 1); &axg_pdm_dai_drv, 1);
......
...@@ -454,7 +454,6 @@ static int axg_spdifin_probe(struct platform_device *pdev) ...@@ -454,7 +454,6 @@ static int axg_spdifin_probe(struct platform_device *pdev)
struct axg_spdifin *priv; struct axg_spdifin *priv;
struct snd_soc_dai_driver *dai_drv; struct snd_soc_dai_driver *dai_drv;
void __iomem *regs; void __iomem *regs;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
...@@ -479,20 +478,12 @@ static int axg_spdifin_probe(struct platform_device *pdev) ...@@ -479,20 +478,12 @@ static int axg_spdifin_probe(struct platform_device *pdev)
} }
priv->pclk = devm_clk_get(dev, "pclk"); priv->pclk = devm_clk_get(dev, "pclk");
if (IS_ERR(priv->pclk)) { if (IS_ERR(priv->pclk))
ret = PTR_ERR(priv->pclk); return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get pclk\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get pclk: %d\n", ret);
return ret;
}
priv->refclk = devm_clk_get(dev, "refclk"); priv->refclk = devm_clk_get(dev, "refclk");
if (IS_ERR(priv->refclk)) { if (IS_ERR(priv->refclk))
ret = PTR_ERR(priv->refclk); return dev_err_probe(dev, PTR_ERR(priv->refclk), "failed to get mclk\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get mclk: %d\n", ret);
return ret;
}
dai_drv = axg_spdifin_get_dai_drv(dev, priv); dai_drv = axg_spdifin_get_dai_drv(dev, priv);
if (IS_ERR(dai_drv)) { if (IS_ERR(dai_drv)) {
......
...@@ -403,7 +403,6 @@ static int axg_spdifout_probe(struct platform_device *pdev) ...@@ -403,7 +403,6 @@ static int axg_spdifout_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct axg_spdifout *priv; struct axg_spdifout *priv;
void __iomem *regs; void __iomem *regs;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
...@@ -422,20 +421,12 @@ static int axg_spdifout_probe(struct platform_device *pdev) ...@@ -422,20 +421,12 @@ static int axg_spdifout_probe(struct platform_device *pdev)
} }
priv->pclk = devm_clk_get(dev, "pclk"); priv->pclk = devm_clk_get(dev, "pclk");
if (IS_ERR(priv->pclk)) { if (IS_ERR(priv->pclk))
ret = PTR_ERR(priv->pclk); return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get pclk\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get pclk: %d\n", ret);
return ret;
}
priv->mclk = devm_clk_get(dev, "mclk"); priv->mclk = devm_clk_get(dev, "mclk");
if (IS_ERR(priv->mclk)) { if (IS_ERR(priv->mclk))
ret = PTR_ERR(priv->mclk); return dev_err_probe(dev, PTR_ERR(priv->mclk), "failed to get mclk\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get mclk: %d\n", ret);
return ret;
}
return devm_snd_soc_register_component(dev, &axg_spdifout_component_drv, return devm_snd_soc_register_component(dev, &axg_spdifout_component_drv,
axg_spdifout_dai_drv, ARRAY_SIZE(axg_spdifout_dai_drv)); axg_spdifout_dai_drv, ARRAY_SIZE(axg_spdifout_dai_drv));
......
...@@ -255,7 +255,6 @@ int axg_tdm_formatter_probe(struct platform_device *pdev) ...@@ -255,7 +255,6 @@ int axg_tdm_formatter_probe(struct platform_device *pdev)
const struct axg_tdm_formatter_driver *drv; const struct axg_tdm_formatter_driver *drv;
struct axg_tdm_formatter *formatter; struct axg_tdm_formatter *formatter;
void __iomem *regs; void __iomem *regs;
int ret;
drv = of_device_get_match_data(dev); drv = of_device_get_match_data(dev);
if (!drv) { if (!drv) {
...@@ -282,57 +281,34 @@ int axg_tdm_formatter_probe(struct platform_device *pdev) ...@@ -282,57 +281,34 @@ int axg_tdm_formatter_probe(struct platform_device *pdev)
/* Peripharal clock */ /* Peripharal clock */
formatter->pclk = devm_clk_get(dev, "pclk"); formatter->pclk = devm_clk_get(dev, "pclk");
if (IS_ERR(formatter->pclk)) { if (IS_ERR(formatter->pclk))
ret = PTR_ERR(formatter->pclk); return dev_err_probe(dev, PTR_ERR(formatter->pclk), "failed to get pclk\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get pclk: %d\n", ret);
return ret;
}
/* Formatter bit clock */ /* Formatter bit clock */
formatter->sclk = devm_clk_get(dev, "sclk"); formatter->sclk = devm_clk_get(dev, "sclk");
if (IS_ERR(formatter->sclk)) { if (IS_ERR(formatter->sclk))
ret = PTR_ERR(formatter->sclk); return dev_err_probe(dev, PTR_ERR(formatter->sclk), "failed to get sclk\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get sclk: %d\n", ret);
return ret;
}
/* Formatter sample clock */ /* Formatter sample clock */
formatter->lrclk = devm_clk_get(dev, "lrclk"); formatter->lrclk = devm_clk_get(dev, "lrclk");
if (IS_ERR(formatter->lrclk)) { if (IS_ERR(formatter->lrclk))
ret = PTR_ERR(formatter->lrclk); return dev_err_probe(dev, PTR_ERR(formatter->lrclk), "failed to get lrclk\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get lrclk: %d\n", ret);
return ret;
}
/* Formatter bit clock input multiplexer */ /* Formatter bit clock input multiplexer */
formatter->sclk_sel = devm_clk_get(dev, "sclk_sel"); formatter->sclk_sel = devm_clk_get(dev, "sclk_sel");
if (IS_ERR(formatter->sclk_sel)) { if (IS_ERR(formatter->sclk_sel))
ret = PTR_ERR(formatter->sclk_sel); return dev_err_probe(dev, PTR_ERR(formatter->sclk_sel), "failed to get sclk_sel\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get sclk_sel: %d\n", ret);
return ret;
}
/* Formatter sample clock input multiplexer */ /* Formatter sample clock input multiplexer */
formatter->lrclk_sel = devm_clk_get(dev, "lrclk_sel"); formatter->lrclk_sel = devm_clk_get(dev, "lrclk_sel");
if (IS_ERR(formatter->lrclk_sel)) { if (IS_ERR(formatter->lrclk_sel))
ret = PTR_ERR(formatter->lrclk_sel); return dev_err_probe(dev, PTR_ERR(formatter->lrclk_sel),
if (ret != -EPROBE_DEFER) "failed to get lrclk_sel\n");
dev_err(dev, "failed to get lrclk_sel: %d\n", ret);
return ret;
}
/* Formatter dedicated reset line */ /* Formatter dedicated reset line */
formatter->reset = devm_reset_control_get_optional_exclusive(dev, NULL); formatter->reset = devm_reset_control_get_optional_exclusive(dev, NULL);
if (IS_ERR(formatter->reset)) { if (IS_ERR(formatter->reset))
ret = PTR_ERR(formatter->reset); return dev_err_probe(dev, PTR_ERR(formatter->reset), "failed to get reset\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get reset: %d\n", ret);
return ret;
}
return devm_snd_soc_register_component(dev, drv->component_drv, return devm_snd_soc_register_component(dev, drv->component_drv,
NULL, 0); NULL, 0);
......
...@@ -533,21 +533,13 @@ static int axg_tdm_iface_probe(struct platform_device *pdev) ...@@ -533,21 +533,13 @@ static int axg_tdm_iface_probe(struct platform_device *pdev)
/* Bit clock provided on the pad */ /* Bit clock provided on the pad */
iface->sclk = devm_clk_get(dev, "sclk"); iface->sclk = devm_clk_get(dev, "sclk");
if (IS_ERR(iface->sclk)) { if (IS_ERR(iface->sclk))
ret = PTR_ERR(iface->sclk); return dev_err_probe(dev, PTR_ERR(iface->sclk), "failed to get sclk\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get sclk: %d\n", ret);
return ret;
}
/* Sample clock provided on the pad */ /* Sample clock provided on the pad */
iface->lrclk = devm_clk_get(dev, "lrclk"); iface->lrclk = devm_clk_get(dev, "lrclk");
if (IS_ERR(iface->lrclk)) { if (IS_ERR(iface->lrclk))
ret = PTR_ERR(iface->lrclk); return dev_err_probe(dev, PTR_ERR(iface->lrclk), "failed to get lrclk\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get lrclk: %d\n", ret);
return ret;
}
/* /*
* mclk maybe be missing when the cpu dai is in slave mode and * mclk maybe be missing when the cpu dai is in slave mode and
...@@ -558,13 +550,10 @@ static int axg_tdm_iface_probe(struct platform_device *pdev) ...@@ -558,13 +550,10 @@ static int axg_tdm_iface_probe(struct platform_device *pdev)
iface->mclk = devm_clk_get(dev, "mclk"); iface->mclk = devm_clk_get(dev, "mclk");
if (IS_ERR(iface->mclk)) { if (IS_ERR(iface->mclk)) {
ret = PTR_ERR(iface->mclk); ret = PTR_ERR(iface->mclk);
if (ret == -ENOENT) { if (ret == -ENOENT)
iface->mclk = NULL; iface->mclk = NULL;
} else { else
if (ret != -EPROBE_DEFER) return dev_err_probe(dev, ret, "failed to get mclk\n");
dev_err(dev, "failed to get mclk: %d\n", ret);
return ret;
}
} }
return devm_snd_soc_register_component(dev, return devm_snd_soc_register_component(dev,
......
...@@ -85,11 +85,9 @@ int meson_card_parse_dai(struct snd_soc_card *card, ...@@ -85,11 +85,9 @@ int meson_card_parse_dai(struct snd_soc_card *card,
ret = of_parse_phandle_with_args(node, "sound-dai", ret = of_parse_phandle_with_args(node, "sound-dai",
"#sound-dai-cells", 0, &args); "#sound-dai-cells", 0, &args);
if (ret) { if (ret)
if (ret != -EPROBE_DEFER) return dev_err_probe(card->dev, ret, "can't parse dai\n");
dev_err(card->dev, "can't parse dai %d\n", ret);
return ret;
}
*dai_of_node = args.np; *dai_of_node = args.np;
return snd_soc_get_dai_name(&args, dai_name); return snd_soc_get_dai_name(&args, dai_name);
......
...@@ -258,18 +258,12 @@ static int t9015_probe(struct platform_device *pdev) ...@@ -258,18 +258,12 @@ static int t9015_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv); platform_set_drvdata(pdev, priv);
priv->pclk = devm_clk_get(dev, "pclk"); priv->pclk = devm_clk_get(dev, "pclk");
if (IS_ERR(priv->pclk)) { if (IS_ERR(priv->pclk))
if (PTR_ERR(priv->pclk) != -EPROBE_DEFER) return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get core clock\n");
dev_err(dev, "failed to get core clock\n");
return PTR_ERR(priv->pclk);
}
priv->avdd = devm_regulator_get(dev, "AVDD"); priv->avdd = devm_regulator_get(dev, "AVDD");
if (IS_ERR(priv->avdd)) { if (IS_ERR(priv->avdd))
if (PTR_ERR(priv->avdd) != -EPROBE_DEFER) return dev_err_probe(dev, PTR_ERR(priv->avdd), "failed to AVDD\n");
dev_err(dev, "failed to AVDD\n");
return PTR_ERR(priv->avdd);
}
ret = clk_prepare_enable(priv->pclk); ret = clk_prepare_enable(priv->pclk);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment