[PATCH v2 6/6] remoteproc: imx_rproc: Clean up after ops introduction

Frank Li Frank.li at nxp.com
Wed Sep 10 08:53:34 PDT 2025


On Wed, Sep 10, 2025 at 03:11:50PM +0800, Peng Fan wrote:
> 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 at nxp.com>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> ---
>  drivers/remoteproc/imx_rproc.c | 34 ++++++++++++----------------------
>  1 file changed, 12 insertions(+), 22 deletions(-)
>
...

> @@ -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) {

Can you remove 'method' in data struct also?

Frank
> -	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)
>
> --
> 2.37.1
>



More information about the linux-arm-kernel mailing list