From: Peng Fan Date: Wed, 19 Nov 2025 04:21:46 +0000 (+0800) Subject: remoteproc: imx_dsp_rproc: Simplify power domain attach and error handling X-Git-Tag: v6.19-rc1~82^2~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3003773ad67ace7c2a0394efdca122824c709dd5;p=thirdparty%2Fkernel%2Flinux.git remoteproc: imx_dsp_rproc: Simplify power domain attach and error handling Refactor imx_dsp_attach_pm_domains() to use devm_pm_domain_attach_list() directly, removing manual detach logic and simplifying resource management. Also replace verbose error handling in imx_dsp_rproc_probe() with dev_err_probe() for cleaner and more consistent error reporting. No functional changes. Reviewed-by: Frank Li Reviewed-by: Daniel Baluta Reviewed-by: Shengjiu Wang Reviewed-by: Iuliana Prodan Tested-by: Iuliana Prodan Signed-off-by: Peng Fan Link: https://lore.kernel.org/r/20251119-imx-dsp-2025-11-19-v4-1-adafd342d07b@nxp.com Signed-off-by: Mathieu Poirier --- diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c index 6e78a01755c7b..1f7d15227ce4f 100644 --- a/drivers/remoteproc/imx_dsp_rproc.c +++ b/drivers/remoteproc/imx_dsp_rproc.c @@ -1062,14 +1062,12 @@ static const struct rproc_ops imx_dsp_rproc_ops = { static int imx_dsp_attach_pm_domains(struct imx_dsp_rproc *priv) { struct device *dev = priv->rproc->dev.parent; - int ret; /* A single PM domain is already attached. */ if (dev->pm_domain) return 0; - ret = dev_pm_domain_attach_list(dev, NULL, &priv->pd_list); - return ret < 0 ? ret : 0; + return devm_pm_domain_attach_list(dev, NULL, &priv->pd_list); } /** @@ -1186,45 +1184,33 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev) /* There are multiple power domains required by DSP on some platform */ ret = imx_dsp_attach_pm_domains(priv); - if (ret) { - dev_err(dev, "failed on imx_dsp_attach_pm_domains\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "failed on imx_dsp_attach_pm_domains\n"); + /* Get clocks */ ret = imx_dsp_rproc_clk_get(priv); - if (ret) { - dev_err(dev, "failed on imx_dsp_rproc_clk_get\n"); - goto err_detach_domains; - } + if (ret) + return dev_err_probe(dev, ret, "failed on imx_dsp_rproc_clk_get\n"); init_completion(&priv->pm_comp); rproc->auto_boot = false; ret = rproc_add(rproc); - if (ret) { - dev_err(dev, "rproc_add failed\n"); - goto err_detach_domains; - } + if (ret) + return dev_err_probe(dev, ret, "rproc_add failed\n"); rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_XTENSA); pm_runtime_enable(dev); return 0; - -err_detach_domains: - dev_pm_domain_detach_list(priv->pd_list); - - return ret; } static void imx_dsp_rproc_remove(struct platform_device *pdev) { struct rproc *rproc = platform_get_drvdata(pdev); - struct imx_dsp_rproc *priv = rproc->priv; pm_runtime_disable(&pdev->dev); rproc_del(rproc); - dev_pm_domain_detach_list(priv->pd_list); } /* pm runtime functions */