Re: [PATCH V7 2/2] firmware: qcom: scm: Add wait-queue handling logic

From: Guru Das Srinagesh
Date: Tue Jan 10 2023 - 15:04:16 EST


On Jan 10 2023 11:54, Bjorn Andersson wrote:
> On Tue, Jan 10, 2023 at 12:14:11AM -0800, Guru Das Srinagesh wrote:
> > On Jan 10 2023 12:07, Sibi Sankar wrote:
> >
> > ...
> >
> > > +static int __scm_smc_do_quirk_handle_waitq(struct device *dev, struct arm_smccc_args *waitq,
> > > + struct arm_smccc_res *res)
> > > +{
> > > + int ret;
> > > + struct arm_smccc_args resume;
> > > + u32 wq_ctx, smc_call_ctx, flags;
> > > + struct arm_smccc_args *smc = waitq;
> > > +
> > > + do {
> > > + __scm_smc_do_quirk(smc, res);
> > > +
> > > + if (res->a0 == QCOM_SCM_WAITQ_SLEEP) {
> > > + wq_ctx = res->a1;
> > > + smc_call_ctx = res->a2;
> > > + flags = res->a3;
> > > +
> > > + if (!dev)
> > > + return -EPROBE_DEFER;
> > > +
> > > + ret = qcom_scm_lookup_completion(wq_ctx);
> >
> > I see that this function has been created in response to Bjorn's comment [1]
> > about avoiding the dev_get_drvdata() call, but I would prefer to not use this
> > function as it hides the fact that the wait_for_completion() is occurring here.
> >
>
> My reasoning here is that I don't want the waiting for the completion
> that happen in one part of the driver and the completion happening in a
> completely different one.

ACK.

Thank you.

Guru Das.