If we stop the q6v5 remoteproc while it is in RPROC_ATTACHED or RPROC_DETACHED state, we still want to send the stop signal to shut it down cleanly. The main goal of the check in qcom_q6v5_request_stop() is to avoid sending duplicate shutdown/stop signals during crash or shutdown via sysmon, so check for RPROC_CRASHED to handle all of RPROC_RUNNING, RPROC_ATTACHED and RPROC_DETACHED. It does not make sense to call the function while in RPROC_OFFLINE state. Signed-off-by: Stephan Gerhold Signed-off-by: Abel Vesa --- drivers/remoteproc/qcom_q6v5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c index 94c75d9cc..ed1b578a8 100644 --- a/drivers/remoteproc/qcom_q6v5.c +++ b/drivers/remoteproc/qcom_q6v5.c @@ -231,8 +231,8 @@ int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5, struct qcom_sysmon *sysmon) q6v5->running = false; - /* A watchdog/fatal IRQ clears running; logical crashes still need a stop. */ - if (!was_running || qcom_sysmon_shutdown_acked(sysmon)) + /* A watchdog/fatal IRQ clears running; logical crashes still need a stop. */ + if (q6v5->rproc->state == RPROC_CRASHED || qcom_sysmon_shutdown_acked(sysmon)) return 0; qcom_smem_state_update_bits(q6v5->state,