From: yuanlinyu 00030184 <yuanlinyu@hihonor.com>
To: Alan Stern <stern@rowland.harvard.edu>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: RE: [RFC PATCH] usb: udc: run disconnect callback before pull up zero
Date: Mon, 22 Jan 2024 01:32:39 +0000 [thread overview]
Message-ID: <1ac27ccf217d4a76bb5bb89a49c2ae4c@hihonor.com> (raw)
In-Reply-To: <41dc2889-c087-4179-88a5-9af80064aa2b@rowland.harvard.edu>
> From: Alan Stern <stern@rowland.harvard.edu>
> Sent: Saturday, January 20, 2024 11:00 PM
> To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> Cc: yuanlinyu 00030184 <yuanlinyu@hihonor.com>; Greg Kroah-Hartman
> <gregkh@linuxfoundation.org>; linux-usb@vger.kernel.org
> Subject: Re: [RFC PATCH] usb: udc: run disconnect callback before pull up zero
>
> On Sat, Jan 20, 2024 at 01:12:04AM +0000, Thinh Nguyen wrote:
> > On Fri, Jan 19, 2024, Alan Stern wrote:
> > > On Fri, Jan 19, 2024 at 01:48:13PM +0800, yuan linyu wrote:
> > > > When write UDC to empty and unbind gadget driver from gadget device, it
> is
> > > > possible that there are many queue failures for mass storage function.
> >
> > That's expected right?
>
> Certainly. And not just for mass storage; for other gadget drivers too.
>
> > > > The root cause is on platform like dwc3, if pull down called first, the
> > > > queue operation from mass storage main thread will fail as it is belong to
> > > > another thread context and always try to receive a command from host.
> > > >
> > > > In order to fix it, call gadget driver disconnect callback first, mass
> > > > storage function driver will disable endpoints and clear running flag,
> > > > so there will be no request queue to UDC.
> > > >
> > > > One note is when call disconnect callback first, it mean function will
> > > > disable endpoints before stop UDC controller.
> > >
> > > Exactly. So instead of getting a bunch of errors on the gadget, now
> > > you'll get a bunch of errors on the host. I don't think that's any
What is host error ?
Seem when host do nothing, but mass storage driver try to queue request
which want to receive command from host.
> > > better.
> > >
> > > Why don't you change the dwc3 driver instead? If it allowed ep_queue
> > > operations to succeed while the pull-up is off then this problem would
> > > go away.
> > >
> >
> > I don't think we should do that either. When pullup off occurs, the
> > device is disconnected for dwc3. usb_ep_queue() doc noted that we
> > should return error on disconnection.
>
> Oh yes, so it does. Okay, forget that idea.
>
> > Beside, it will add unnecessary
> > complication to dwc3 handling this.
>
> How about instead just reducing the visibility of these error messages
It is already change to dev_dbg() by Wesley Cheng for dwc3.
But it also can enable by change log level. Only delete it will not show again.
this thread just want to discuss if disable eps first then pull up zero acceptable or
good (reduce mode switch time ???) for all UDCs ?
> to make them less annoying? They aren't very important, after all --
> they don't indicate that anything has gone seriously wrong.
>
> Alan Stern
next prev parent reply other threads:[~2024-01-22 1:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 5:48 [RFC PATCH] usb: udc: run disconnect callback before pull up zero yuan linyu
2024-01-19 14:49 ` Alan Stern
2024-01-20 1:12 ` Thinh Nguyen
2024-01-20 15:00 ` Alan Stern
2024-01-22 1:32 ` yuanlinyu 00030184 [this message]
2024-01-22 2:30 ` Alan Stern
2024-01-22 2:54 ` yuanlinyu 00030184
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=1ac27ccf217d4a76bb5bb89a49c2ae4c@hihonor.com \
--to=yuanlinyu@hihonor.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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