Commit 324c603a authored by AngeloGioacchino Del Regno's avatar AngeloGioacchino Del Regno Committed by Mark Brown

ASoC: mediatek: mt8192-afe-pcm: Simplify with dev_err_probe()

Simplify the probe function by switching error prints to return
dev_err_probe(), lowering the lines count; while at it, also
beautify some messages and change some others' level from warn
to error.
Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: default avatarChen-Yu Tsai <wenst@chromium.org>
Link: https://msgid.link/r/20240313110147.1267793-3-angelogioacchino.delregno@collabora.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7aaaa22d
...@@ -2205,17 +2205,12 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) ...@@ -2205,17 +2205,12 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
/* reset controller to reset audio regs before regmap cache */ /* reset controller to reset audio regs before regmap cache */
rstc = devm_reset_control_get_exclusive(dev, "audiosys"); rstc = devm_reset_control_get_exclusive(dev, "audiosys");
if (IS_ERR(rstc)) { if (IS_ERR(rstc))
ret = PTR_ERR(rstc); return dev_err_probe(dev, PTR_ERR(rstc), "could not get audiosys reset\n");
dev_err(dev, "could not get audiosys reset:%d\n", ret);
return ret;
}
ret = reset_control_reset(rstc); ret = reset_control_reset(rstc);
if (ret) { if (ret)
dev_err(dev, "failed to trigger audio reset:%d\n", ret); return dev_err_probe(dev, ret, "failed to trigger audio reset\n");
return ret;
}
ret = devm_pm_runtime_enable(&pdev->dev); ret = devm_pm_runtime_enable(&pdev->dev);
if (ret) if (ret)
...@@ -2223,25 +2218,21 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) ...@@ -2223,25 +2218,21 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
/* regmap init */ /* regmap init */
afe->regmap = syscon_node_to_regmap(dev->parent->of_node); afe->regmap = syscon_node_to_regmap(dev->parent->of_node);
if (IS_ERR(afe->regmap)) { if (IS_ERR(afe->regmap))
dev_err(dev, "could not get regmap from parent\n"); return dev_err_probe(dev, PTR_ERR(afe->regmap),
return PTR_ERR(afe->regmap); "could not get regmap from parent");
}
ret = regmap_attach_dev(dev, afe->regmap, &mt8192_afe_regmap_config); ret = regmap_attach_dev(dev, afe->regmap, &mt8192_afe_regmap_config);
if (ret) { if (ret)
dev_warn(dev, "regmap_attach_dev fail, ret %d\n", ret); return dev_err_probe(dev, ret, "regmap_attach_dev fail\n");
return ret;
}
/* enable clock for regcache get default value from hw */ /* enable clock for regcache get default value from hw */
afe_priv->pm_runtime_bypass_reg_ctl = true; afe_priv->pm_runtime_bypass_reg_ctl = true;
pm_runtime_get_sync(&pdev->dev); pm_runtime_get_sync(&pdev->dev);
ret = regmap_reinit_cache(afe->regmap, &mt8192_afe_regmap_config); ret = regmap_reinit_cache(afe->regmap, &mt8192_afe_regmap_config);
if (ret) { if (ret)
dev_err(dev, "regmap_reinit_cache fail, ret %d\n", ret); return dev_err_probe(dev, ret, "regmap_reinit_cache fail\n");
return ret;
}
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
afe_priv->pm_runtime_bypass_reg_ctl = false; afe_priv->pm_runtime_bypass_reg_ctl = false;
...@@ -2281,30 +2272,22 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) ...@@ -2281,30 +2272,22 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
ret = devm_request_irq(dev, irq_id, mt8192_afe_irq_handler, ret = devm_request_irq(dev, irq_id, mt8192_afe_irq_handler,
IRQF_TRIGGER_NONE, "asys-isr", (void *)afe); IRQF_TRIGGER_NONE, "asys-isr", (void *)afe);
if (ret) { if (ret)
dev_err(dev, "could not request_irq for Afe_ISR_Handle\n"); return dev_err_probe(dev, ret, "could not request_irq for Afe_ISR_Handle\n");
return ret;
}
/* init sub_dais */ /* init sub_dais */
INIT_LIST_HEAD(&afe->sub_dais); INIT_LIST_HEAD(&afe->sub_dais);
for (i = 0; i < ARRAY_SIZE(dai_register_cbs); i++) { for (i = 0; i < ARRAY_SIZE(dai_register_cbs); i++) {
ret = dai_register_cbs[i](afe); ret = dai_register_cbs[i](afe);
if (ret) { if (ret)
dev_warn(afe->dev, "dai register i %d fail, ret %d\n", return dev_err_probe(afe->dev, ret, "dai %d register fail", i);
i, ret);
return ret;
}
} }
/* init dai_driver and component_driver */ /* init dai_driver and component_driver */
ret = mtk_afe_combine_sub_dai(afe); ret = mtk_afe_combine_sub_dai(afe);
if (ret) { if (ret)
dev_warn(afe->dev, "mtk_afe_combine_sub_dai fail, ret %d\n", return dev_err_probe(afe->dev, ret, "mtk_afe_combine_sub_dai fail\n");
ret);
return ret;
}
/* others */ /* others */
afe->mtk_afe_hardware = &mt8192_afe_hardware; afe->mtk_afe_hardware = &mt8192_afe_hardware;
...@@ -2320,19 +2303,15 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) ...@@ -2320,19 +2303,15 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
/* register platform */ /* register platform */
ret = devm_snd_soc_register_component(&pdev->dev, ret = devm_snd_soc_register_component(&pdev->dev,
&mt8192_afe_component, NULL, 0); &mt8192_afe_component, NULL, 0);
if (ret) { if (ret)
dev_warn(dev, "err_platform\n"); return dev_err_probe(dev, ret, "Couldn't register AFE component\n");
return ret;
}
ret = devm_snd_soc_register_component(&pdev->dev, ret = devm_snd_soc_register_component(&pdev->dev,
&mt8192_afe_pcm_component, &mt8192_afe_pcm_component,
afe->dai_drivers, afe->dai_drivers,
afe->num_dai_drivers); afe->num_dai_drivers);
if (ret) { if (ret)
dev_warn(dev, "err_dai_component\n"); return dev_err_probe(dev, ret, "Couldn't register AFE-PCM component\n");
return ret;
}
return 0; return 0;
} }
......
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