linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: mhi@lists.linux.dev, hemantk@codeaurora.org,
	bbhatt@codeaurora.org, loic.poulain@linaro.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	ath11k@lists.infradead.org, linux-wireless@vger.kernel.org,
	kvalo@codeaurora.org, stable@vger.kernel.org,
	Pengyu Ma <mapengyu@gmail.com>, Kalle Valo <kvalo@kernel.org>
Subject: Re: [PATCH 1/1] bus: mhi: core: Add support for forced PM resume
Date: Wed, 8 Dec 2021 15:10:35 +0530	[thread overview]
Message-ID: <20211208094035.GF70121@thinkpad> (raw)
In-Reply-To: <YbB11M0FZ+AdELPa@kroah.com>

On Wed, Dec 08, 2021 at 10:07:32AM +0100, Greg KH wrote:

[...]

> > diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> > index 723985879035..102303288cee 100644
> > --- a/include/linux/mhi.h
> > +++ b/include/linux/mhi.h
> > @@ -660,8 +660,9 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl);
> >  /**
> >   * mhi_pm_resume - Resume MHI from suspended state
> >   * @mhi_cntrl: MHI controller
> > + * @force: Force resuming to M0 irrespective of the device MHI state
> >   */
> > -int mhi_pm_resume(struct mhi_controller *mhi_cntrl);
> > +int mhi_pm_resume(struct mhi_controller *mhi_cntrl, bool force);
> 
> apis like this are horrid to work with over time.
> 
> Why not just have:
> 	mhi_pm_resume_force()
> which then internally can set a flag that does this?  That way the
> driver author does not have to stop every time they see this call and
> look up exactly what the true/false field means in the function call in
> their driver.
> 

Okay.

> It also lets you leave alone the existing calls to mhi_pm_suspend() that
> do not want to "force" anything.
> 
> self-documenting code is good, this is not self-documenting at all.
> 
> Also, is "force" really what you are doing here?  This is a "normal"
> resume call, which should always work.

The normal resume here is resuming with M3 state only.

> The "force" option here really
> is just "ignore the current state of suspend for the device".  So
> perhaps mhi_pm_resume_ignore_current_state() might be better?  Or
> something shorter?
> 

And we are actually forcing here. As per the MHI spec, the devices has to be in
M3 state during resume. So if we allow any device to go through resume without
being in M3, that implies we are doing a force resume.

I'll use the mhi_pm_resume_force() API as you suggested.

Thanks,
Mani

> Naming is hard, sorry.
> 
> thanks,
> 
> greg k-h

      reply	other threads:[~2021-12-08  9:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08  8:57 [PATCH 0/1] MHI fix for v5.16 - Take 2 Manivannan Sadhasivam
2021-12-08  8:57 ` [PATCH 1/1] bus: mhi: core: Add support for forced PM resume Manivannan Sadhasivam
2021-12-08  9:07   ` Greg KH
2021-12-08  9:40     ` Manivannan Sadhasivam [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211208094035.GF70121@thinkpad \
    --to=manivannan.sadhasivam@linaro.org \
    --cc=ath11k@lists.infradead.org \
    --cc=bbhatt@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hemantk@codeaurora.org \
    --cc=kvalo@codeaurora.org \
    --cc=kvalo@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=mapengyu@gmail.com \
    --cc=mhi@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).