mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 15:39:42 -04:00
remoteproc: imx_rproc: Clean up after ops introduction
With the switch-case in imx_rproc_{start,stop}{} removed, simplify
the code logic by removing 'goto'. The last switch-case in
imx_rproc_detect_mode() are no longer needed and can be removed.
This cleanup improves code readability and aligns with the new ops-based
design.
No functional changes.
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250910-imx-rproc-cleanup-v2-6-10386685b8a9@nxp.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
This commit is contained in:
committed by
Mathieu Poirier
parent
ecadd767fb
commit
e65a9ed4c3
@@ -323,14 +323,10 @@ static int imx_rproc_start(struct rproc *rproc)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (dcfg->ops && dcfg->ops->start) {
|
||||
ret = dcfg->ops->start(rproc);
|
||||
goto start_ret;
|
||||
}
|
||||
if (!dcfg->ops || !dcfg->ops->start)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
start_ret:
|
||||
ret = dcfg->ops->start(rproc);
|
||||
if (ret)
|
||||
dev_err(dev, "Failed to enable remote core!\n");
|
||||
|
||||
@@ -380,14 +376,10 @@ static int imx_rproc_stop(struct rproc *rproc)
|
||||
struct device *dev = priv->dev;
|
||||
int ret;
|
||||
|
||||
if (dcfg->ops && dcfg->ops->stop) {
|
||||
ret = dcfg->ops->stop(rproc);
|
||||
goto stop_ret;
|
||||
}
|
||||
if (!dcfg->ops || !dcfg->ops->stop)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
stop_ret:
|
||||
ret = dcfg->ops->stop(rproc);
|
||||
if (ret)
|
||||
dev_err(dev, "Failed to stop remote core\n");
|
||||
else
|
||||
@@ -997,18 +989,16 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv)
|
||||
{
|
||||
const struct imx_rproc_dcfg *dcfg = priv->dcfg;
|
||||
|
||||
if (dcfg->ops && dcfg->ops->detect_mode)
|
||||
return dcfg->ops->detect_mode(priv->rproc);
|
||||
|
||||
switch (dcfg->method) {
|
||||
case IMX_RPROC_NONE:
|
||||
/*
|
||||
* To i.MX{7,8} ULP, Linux is under control of RTOS, no need
|
||||
* dcfg->ops or dcfg->ops->detect_mode, it is state RPROC_DETACHED.
|
||||
*/
|
||||
if (!dcfg->ops || !dcfg->ops->detect_mode) {
|
||||
priv->rproc->state = RPROC_DETACHED;
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return dcfg->ops->detect_mode(priv->rproc);
|
||||
}
|
||||
|
||||
static int imx_rproc_clk_enable(struct imx_rproc *priv)
|
||||
|
||||
Reference in New Issue
Block a user