On Jul 01 2022 16:51, Rajendra Nayak wrote: > >>+ > >>+ if (res->a0 == QCOM_SCM_WAITQ_SLEEP) { > >>+ wait_for_completion(wq); > >>+ fill_wq_resume_args(smc, smc_call_ctx); > >>+ wq = NULL; > >>+ continue; > >>+ } else { > >>+ fill_wq_wake_ack_args(smc, smc_call_ctx); > >>+ continue; > >>+ } > >>+ } else if ((long)res->a0 < 0) { > >>+ /* Error, simply return to caller */ > >>+ break; > > if my understanding above is correct, shouldn't we do a > >>+ if (wq) > >>+ scm_waitq_flag_handler(wq, flags); > in the error case also? Yes, you're right, since both error or success means that a request is complete. We should act the same way for error as for success. Thanks for catching this. > Also why no just scm_waitq_flag_handler(wq, flags); before fill_wq_wake_ack_args(smc, smc_call_ctx);? Because that is not part of the protocol - calling scm_waitq_flag_handler(wq, flags) would result in a completion being freed, meaning a sleeping call would be woken up, which is not what we want. When a WAITQ_WAKE is received, the action to be taken is to immediately respond with a wq_wake_ack() and nothing else.