All of lore.kernel.org
 help / color / mirror / Atom feed
From: dinghao.liu@zju.edu.cn
To: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Cc: kjlu@umn.edu, "Fuqian Huang" <huangfq.daxian@gmail.com>,
	"Benson Leung" <bleung@chromium.org>,
	"Andrzej Pietrasiewicz" <andrzej.p@collabora.com>,
	"Lee Jones" <lee.jones@linaro.org>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH] Input: cyapa - Fix rumtime PM imbalance on error
Date: Thu, 8 Apr 2021 14:29:16 +0800 (GMT+08:00)	[thread overview]
Message-ID: <1043c456.41319.178b02bb004.Coremail.dinghao.liu@zju.edu.cn> (raw)
In-Reply-To: <YG6ggJyKT/eIlEGk@google.com>

> Hi Dinghao,
> 
> On Wed, Apr 07, 2021 at 12:07:38PM +0800, Dinghao Liu wrote:
> > When mutex_lock_interruptible() fails, a pairing PM usage
> > counter decrement is needed to keep the counter balanced.
> 
> Thank you for the patch.
> 
> > 
> > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> > ---
> >  drivers/input/mouse/cyapa.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
> > index 77cc653edca2..e411ab45a218 100644
> > --- a/drivers/input/mouse/cyapa.c
> > +++ b/drivers/input/mouse/cyapa.c
> > @@ -904,8 +904,10 @@ static ssize_t cyapa_update_rt_suspend_scanrate(struct device *dev,
> >  	pm_runtime_get_sync(dev);
> >  
> >  	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
> > -	if (error)
> > +	if (error) {
> > +		pm_runtime_put_noidle(dev);
> 
> Why "noidle" and not pm_runtime_put_sync_autosuspend() like we do in
> case of normal flow?
> 

pm_runtime_put_noidle() only decrease the refcount, while 
pm_runtime_put_sync_autosuspend() will execute an extra
pm_runtime_autosuspend(). I'm not sure if the autosuspend is necessary
in this error handling path, so I only balance the counter.

Regards,
Dinghao

      reply	other threads:[~2021-04-08  6:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07  4:07 [PATCH] Input: cyapa - Fix rumtime PM imbalance on error Dinghao Liu
2021-04-08  6:19 ` Dmitry Torokhov
2021-04-08  6:29   ` dinghao.liu [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=1043c456.41319.178b02bb004.Coremail.dinghao.liu@zju.edu.cn \
    --to=dinghao.liu@zju.edu.cn \
    --cc=andrzej.p@collabora.com \
    --cc=bleung@chromium.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=huangfq.daxian@gmail.com \
    --cc=kjlu@umn.edu \
    --cc=lee.jones@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.