linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Salah Triki <salah.triki@gmail.com>, linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: chipidea: get lock before calling usb_[disable|enable]_autosuspend()
Date: Mon, 9 Aug 2021 08:42:14 +0800	[thread overview]
Message-ID: <20210809004214.GA6693@nchen> (raw)
In-Reply-To: <YQu2Yys43Egstxmn@kroah.com>

On 21-08-05 11:58:59, Greg Kroah-Hartman wrote:
> On Wed, Aug 04, 2021 at 09:38:09AM +0800, Peter Chen wrote:
> > On 21-08-02 22:52:12, Salah Triki wrote:
> > > Based on the documentation of usb_[disable|enable]_autosuspend(), the
> > > caller must hold udev's device lock.
> > > 
> > > Signed-off-by: Salah Triki <salah.triki@gmail.com>
> > > ---
> > >  drivers/usb/chipidea/otg_fsm.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
> > > index 6ed4b00dba96..2d4174250432 100644
> > > --- a/drivers/usb/chipidea/otg_fsm.c
> > > +++ b/drivers/usb/chipidea/otg_fsm.c
> > > @@ -518,12 +518,14 @@ static void ci_otg_loc_sof(struct otg_fsm *fsm, int on)
> > >  	if (!udev)
> > >  		return;
> > >  
> > > +	usb_lock_device(udev);
> > >  	if (on) {
> > >  		usb_disable_autosuspend(udev);
> > >  	} else {
> > >  		pm_runtime_set_autosuspend_delay(&udev->dev, 0);
> > >  		usb_enable_autosuspend(udev);
> > >  	}
> > > +	usb_unlock_device(udev);
> > >  }
> > >  
> > 
> > Acked-by: Peter Chen <peter.chen@kernel.org>
> 
> I think this is not ok, see the other threads...

Thanks for checking it, I read Alan's comments for the similar patches.
Yes, it doesn't need since all callers have already holds fsm->lock.

-- 

Thanks,
Peter Chen


      reply	other threads:[~2021-08-09  0:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02 21:52 [PATCH] usb: chipidea: get lock before calling usb_[disable|enable]_autosuspend() Salah Triki
2021-08-04  1:38 ` Peter Chen
2021-08-05  9:58   ` Greg Kroah-Hartman
2021-08-09  0:42     ` Peter Chen [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=20210809004214.GA6693@nchen \
    --to=peter.chen@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=salah.triki@gmail.com \
    /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).