Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Peng Fan and committed by
Mathieu Poirier
e65a9ed4 ecadd767

+12 -22
+12 -22
drivers/remoteproc/imx_rproc.c
··· 323 323 if (ret) 324 324 return ret; 325 325 326 - if (dcfg->ops && dcfg->ops->start) { 327 - ret = dcfg->ops->start(rproc); 328 - goto start_ret; 329 - } 326 + if (!dcfg->ops || !dcfg->ops->start) 327 + return -EOPNOTSUPP; 330 328 331 - return -EOPNOTSUPP; 332 - 333 - start_ret: 329 + ret = dcfg->ops->start(rproc); 334 330 if (ret) 335 331 dev_err(dev, "Failed to enable remote core!\n"); 336 332 ··· 376 380 struct device *dev = priv->dev; 377 381 int ret; 378 382 379 - if (dcfg->ops && dcfg->ops->stop) { 380 - ret = dcfg->ops->stop(rproc); 381 - goto stop_ret; 382 - } 383 + if (!dcfg->ops || !dcfg->ops->stop) 384 + return -EOPNOTSUPP; 383 385 384 - return -EOPNOTSUPP; 385 - 386 - stop_ret: 386 + ret = dcfg->ops->stop(rproc); 387 387 if (ret) 388 388 dev_err(dev, "Failed to stop remote core\n"); 389 389 else ··· 989 997 { 990 998 const struct imx_rproc_dcfg *dcfg = priv->dcfg; 991 999 992 - if (dcfg->ops && dcfg->ops->detect_mode) 993 - return dcfg->ops->detect_mode(priv->rproc); 994 - 995 - switch (dcfg->method) { 996 - case IMX_RPROC_NONE: 1000 + /* 1001 + * To i.MX{7,8} ULP, Linux is under control of RTOS, no need 1002 + * dcfg->ops or dcfg->ops->detect_mode, it is state RPROC_DETACHED. 1003 + */ 1004 + if (!dcfg->ops || !dcfg->ops->detect_mode) { 997 1005 priv->rproc->state = RPROC_DETACHED; 998 1006 return 0; 999 - default: 1000 - break; 1001 1007 } 1002 1008 1003 - return 0; 1009 + return dcfg->ops->detect_mode(priv->rproc); 1004 1010 } 1005 1011 1006 1012 static int imx_rproc_clk_enable(struct imx_rproc *priv)