mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
ASoC: meson: Use dev_err_probe() helper
Use the dev_err_probe() helper, instead of open-coding the same operation. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/20211214020843.2225831-17-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
ef12f373f2
commit
2ff4e003e8
@ -218,34 +218,23 @@ static int aiu_clk_get(struct device *dev)
|
||||
int ret;
|
||||
|
||||
aiu->pclk = devm_clk_get(dev, "pclk");
|
||||
if (IS_ERR(aiu->pclk)) {
|
||||
if (PTR_ERR(aiu->pclk) != -EPROBE_DEFER)
|
||||
dev_err(dev, "Can't get the aiu pclk\n");
|
||||
return PTR_ERR(aiu->pclk);
|
||||
}
|
||||
if (IS_ERR(aiu->pclk))
|
||||
return dev_err_probe(dev, PTR_ERR(aiu->pclk), "Can't get the aiu pclk\n");
|
||||
|
||||
aiu->spdif_mclk = devm_clk_get(dev, "spdif_mclk");
|
||||
if (IS_ERR(aiu->spdif_mclk)) {
|
||||
if (PTR_ERR(aiu->spdif_mclk) != -EPROBE_DEFER)
|
||||
dev_err(dev, "Can't get the aiu spdif master clock\n");
|
||||
return PTR_ERR(aiu->spdif_mclk);
|
||||
}
|
||||
if (IS_ERR(aiu->spdif_mclk))
|
||||
return dev_err_probe(dev, PTR_ERR(aiu->spdif_mclk),
|
||||
"Can't get the aiu spdif master clock\n");
|
||||
|
||||
ret = aiu_clk_bulk_get(dev, aiu_i2s_ids, ARRAY_SIZE(aiu_i2s_ids),
|
||||
&aiu->i2s);
|
||||
if (ret) {
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "Can't get the i2s clocks\n");
|
||||
return ret;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Can't get the i2s clocks\n");
|
||||
|
||||
ret = aiu_clk_bulk_get(dev, aiu_spdif_ids, ARRAY_SIZE(aiu_spdif_ids),
|
||||
&aiu->spdif);
|
||||
if (ret) {
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "Can't get the spdif clocks\n");
|
||||
return ret;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Can't get the spdif clocks\n");
|
||||
|
||||
ret = clk_prepare_enable(aiu->pclk);
|
||||
if (ret) {
|
||||
@ -281,11 +270,8 @@ static int aiu_probe(struct platform_device *pdev)
|
||||
platform_set_drvdata(pdev, aiu);
|
||||
|
||||
ret = device_reset(dev);
|
||||
if (ret) {
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "Failed to reset device\n");
|
||||
return ret;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Failed to reset device\n");
|
||||
|
||||
regs = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(regs))
|
||||
|
@ -351,20 +351,12 @@ int axg_fifo_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
fifo->pclk = devm_clk_get(dev, NULL);
|
||||
if (IS_ERR(fifo->pclk)) {
|
||||
if (PTR_ERR(fifo->pclk) != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get pclk: %ld\n",
|
||||
PTR_ERR(fifo->pclk));
|
||||
return PTR_ERR(fifo->pclk);
|
||||
}
|
||||
if (IS_ERR(fifo->pclk))
|
||||
return dev_err_probe(dev, PTR_ERR(fifo->pclk), "failed to get pclk\n");
|
||||
|
||||
fifo->arb = devm_reset_control_get_exclusive(dev, NULL);
|
||||
if (IS_ERR(fifo->arb)) {
|
||||
if (PTR_ERR(fifo->arb) != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get arb reset: %ld\n",
|
||||
PTR_ERR(fifo->arb));
|
||||
return PTR_ERR(fifo->arb);
|
||||
}
|
||||
if (IS_ERR(fifo->arb))
|
||||
return dev_err_probe(dev, PTR_ERR(fifo->arb), "failed to get arb reset\n");
|
||||
|
||||
fifo->irq = of_irq_get(dev->of_node, 0);
|
||||
if (fifo->irq <= 0) {
|
||||
|
@ -586,7 +586,6 @@ static int axg_pdm_probe(struct platform_device *pdev)
|
||||
struct device *dev = &pdev->dev;
|
||||
struct axg_pdm *priv;
|
||||
void __iomem *regs;
|
||||
int ret;
|
||||
|
||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
@ -611,28 +610,16 @@ static int axg_pdm_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
priv->pclk = devm_clk_get(dev, "pclk");
|
||||
if (IS_ERR(priv->pclk)) {
|
||||
ret = PTR_ERR(priv->pclk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get pclk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(priv->pclk))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get pclk\n");
|
||||
|
||||
priv->dclk = devm_clk_get(dev, "dclk");
|
||||
if (IS_ERR(priv->dclk)) {
|
||||
ret = PTR_ERR(priv->dclk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get dclk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(priv->dclk))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->dclk), "failed to get dclk\n");
|
||||
|
||||
priv->sysclk = devm_clk_get(dev, "sysclk");
|
||||
if (IS_ERR(priv->sysclk)) {
|
||||
ret = PTR_ERR(priv->sysclk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get dclk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(priv->sysclk))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->sysclk), "failed to get dclk\n");
|
||||
|
||||
return devm_snd_soc_register_component(dev, &axg_pdm_component_drv,
|
||||
&axg_pdm_dai_drv, 1);
|
||||
|
@ -454,7 +454,6 @@ static int axg_spdifin_probe(struct platform_device *pdev)
|
||||
struct axg_spdifin *priv;
|
||||
struct snd_soc_dai_driver *dai_drv;
|
||||
void __iomem *regs;
|
||||
int ret;
|
||||
|
||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
@ -479,20 +478,12 @@ static int axg_spdifin_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
priv->pclk = devm_clk_get(dev, "pclk");
|
||||
if (IS_ERR(priv->pclk)) {
|
||||
ret = PTR_ERR(priv->pclk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get pclk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(priv->pclk))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get pclk\n");
|
||||
|
||||
priv->refclk = devm_clk_get(dev, "refclk");
|
||||
if (IS_ERR(priv->refclk)) {
|
||||
ret = PTR_ERR(priv->refclk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get mclk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(priv->refclk))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->refclk), "failed to get mclk\n");
|
||||
|
||||
dai_drv = axg_spdifin_get_dai_drv(dev, priv);
|
||||
if (IS_ERR(dai_drv)) {
|
||||
|
@ -403,7 +403,6 @@ static int axg_spdifout_probe(struct platform_device *pdev)
|
||||
struct device *dev = &pdev->dev;
|
||||
struct axg_spdifout *priv;
|
||||
void __iomem *regs;
|
||||
int ret;
|
||||
|
||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
@ -422,20 +421,12 @@ static int axg_spdifout_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
priv->pclk = devm_clk_get(dev, "pclk");
|
||||
if (IS_ERR(priv->pclk)) {
|
||||
ret = PTR_ERR(priv->pclk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get pclk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(priv->pclk))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get pclk\n");
|
||||
|
||||
priv->mclk = devm_clk_get(dev, "mclk");
|
||||
if (IS_ERR(priv->mclk)) {
|
||||
ret = PTR_ERR(priv->mclk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get mclk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(priv->mclk))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->mclk), "failed to get mclk\n");
|
||||
|
||||
return devm_snd_soc_register_component(dev, &axg_spdifout_component_drv,
|
||||
axg_spdifout_dai_drv, ARRAY_SIZE(axg_spdifout_dai_drv));
|
||||
|
@ -255,7 +255,6 @@ int axg_tdm_formatter_probe(struct platform_device *pdev)
|
||||
const struct axg_tdm_formatter_driver *drv;
|
||||
struct axg_tdm_formatter *formatter;
|
||||
void __iomem *regs;
|
||||
int ret;
|
||||
|
||||
drv = of_device_get_match_data(dev);
|
||||
if (!drv) {
|
||||
@ -282,57 +281,34 @@ int axg_tdm_formatter_probe(struct platform_device *pdev)
|
||||
|
||||
/* Peripharal clock */
|
||||
formatter->pclk = devm_clk_get(dev, "pclk");
|
||||
if (IS_ERR(formatter->pclk)) {
|
||||
ret = PTR_ERR(formatter->pclk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get pclk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(formatter->pclk))
|
||||
return dev_err_probe(dev, PTR_ERR(formatter->pclk), "failed to get pclk\n");
|
||||
|
||||
/* Formatter bit clock */
|
||||
formatter->sclk = devm_clk_get(dev, "sclk");
|
||||
if (IS_ERR(formatter->sclk)) {
|
||||
ret = PTR_ERR(formatter->sclk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get sclk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(formatter->sclk))
|
||||
return dev_err_probe(dev, PTR_ERR(formatter->sclk), "failed to get sclk\n");
|
||||
|
||||
/* Formatter sample clock */
|
||||
formatter->lrclk = devm_clk_get(dev, "lrclk");
|
||||
if (IS_ERR(formatter->lrclk)) {
|
||||
ret = PTR_ERR(formatter->lrclk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get lrclk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(formatter->lrclk))
|
||||
return dev_err_probe(dev, PTR_ERR(formatter->lrclk), "failed to get lrclk\n");
|
||||
|
||||
/* Formatter bit clock input multiplexer */
|
||||
formatter->sclk_sel = devm_clk_get(dev, "sclk_sel");
|
||||
if (IS_ERR(formatter->sclk_sel)) {
|
||||
ret = PTR_ERR(formatter->sclk_sel);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get sclk_sel: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(formatter->sclk_sel))
|
||||
return dev_err_probe(dev, PTR_ERR(formatter->sclk_sel), "failed to get sclk_sel\n");
|
||||
|
||||
/* Formatter sample clock input multiplexer */
|
||||
formatter->lrclk_sel = devm_clk_get(dev, "lrclk_sel");
|
||||
if (IS_ERR(formatter->lrclk_sel)) {
|
||||
ret = PTR_ERR(formatter->lrclk_sel);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get lrclk_sel: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(formatter->lrclk_sel))
|
||||
return dev_err_probe(dev, PTR_ERR(formatter->lrclk_sel),
|
||||
"failed to get lrclk_sel\n");
|
||||
|
||||
/* Formatter dedicated reset line */
|
||||
formatter->reset = devm_reset_control_get_optional_exclusive(dev, NULL);
|
||||
if (IS_ERR(formatter->reset)) {
|
||||
ret = PTR_ERR(formatter->reset);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get reset: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(formatter->reset))
|
||||
return dev_err_probe(dev, PTR_ERR(formatter->reset), "failed to get reset\n");
|
||||
|
||||
return devm_snd_soc_register_component(dev, drv->component_drv,
|
||||
NULL, 0);
|
||||
|
@ -533,21 +533,13 @@ static int axg_tdm_iface_probe(struct platform_device *pdev)
|
||||
|
||||
/* Bit clock provided on the pad */
|
||||
iface->sclk = devm_clk_get(dev, "sclk");
|
||||
if (IS_ERR(iface->sclk)) {
|
||||
ret = PTR_ERR(iface->sclk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get sclk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(iface->sclk))
|
||||
return dev_err_probe(dev, PTR_ERR(iface->sclk), "failed to get sclk\n");
|
||||
|
||||
/* Sample clock provided on the pad */
|
||||
iface->lrclk = devm_clk_get(dev, "lrclk");
|
||||
if (IS_ERR(iface->lrclk)) {
|
||||
ret = PTR_ERR(iface->lrclk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get lrclk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(iface->lrclk))
|
||||
return dev_err_probe(dev, PTR_ERR(iface->lrclk), "failed to get lrclk\n");
|
||||
|
||||
/*
|
||||
* 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)
|
||||
iface->mclk = devm_clk_get(dev, "mclk");
|
||||
if (IS_ERR(iface->mclk)) {
|
||||
ret = PTR_ERR(iface->mclk);
|
||||
if (ret == -ENOENT) {
|
||||
if (ret == -ENOENT)
|
||||
iface->mclk = NULL;
|
||||
} else {
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get mclk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
return dev_err_probe(dev, ret, "failed to get mclk\n");
|
||||
}
|
||||
|
||||
return devm_snd_soc_register_component(dev,
|
||||
|
@ -85,11 +85,9 @@ int meson_card_parse_dai(struct snd_soc_card *card,
|
||||
|
||||
ret = of_parse_phandle_with_args(node, "sound-dai",
|
||||
"#sound-dai-cells", 0, &args);
|
||||
if (ret) {
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(card->dev, "can't parse dai %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(card->dev, ret, "can't parse dai\n");
|
||||
|
||||
*dai_of_node = args.np;
|
||||
|
||||
return snd_soc_get_dai_name(&args, dai_name);
|
||||
|
@ -258,18 +258,12 @@ static int t9015_probe(struct platform_device *pdev)
|
||||
platform_set_drvdata(pdev, priv);
|
||||
|
||||
priv->pclk = devm_clk_get(dev, "pclk");
|
||||
if (IS_ERR(priv->pclk)) {
|
||||
if (PTR_ERR(priv->pclk) != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to get core clock\n");
|
||||
return PTR_ERR(priv->pclk);
|
||||
}
|
||||
if (IS_ERR(priv->pclk))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get core clock\n");
|
||||
|
||||
priv->avdd = devm_regulator_get(dev, "AVDD");
|
||||
if (IS_ERR(priv->avdd)) {
|
||||
if (PTR_ERR(priv->avdd) != -EPROBE_DEFER)
|
||||
dev_err(dev, "failed to AVDD\n");
|
||||
return PTR_ERR(priv->avdd);
|
||||
}
|
||||
if (IS_ERR(priv->avdd))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->avdd), "failed to AVDD\n");
|
||||
|
||||
ret = clk_prepare_enable(priv->pclk);
|
||||
if (ret) {
|
||||
|
Loading…
Reference in New Issue
Block a user