From: Anton Vorontsov <avorontsov@ru•mvista.com>
To: Alan Stern <stern@rowland•harvard.edu>
Cc: Greg Kroah-Hartman <greg@kroah•com>,
David Brownell <dbrownell@users•sourceforge.net>,
Li Yang <leoli@freescale•com>,
linux-usb@vger•kernel.org, linuxppc-dev@ozlabs•org
Subject: Re: [PATCH] usb/fsl_qe_udc: Report disconnect before unbinding
Date: Wed, 12 Nov 2008 23:20:17 +0300 [thread overview]
Message-ID: <20081112202017.GA5161@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20081112201218.GA5870@oksana.dev.rtsoft.ru>
On Wed, Nov 12, 2008 at 11:12:18PM +0300, Anton Vorontsov wrote:
> On Wed, Nov 12, 2008 at 10:59:16PM +0300, Anton Vorontsov wrote:
> [...]
> > > And wouldn't it be better to _skip_ doing this if the gadget wasn't
> > > connected before?
> >
> > Composite framework handles this. If there were no connections,
> > then the disconnect() is a nop (except the spin lock/unlock pair).
> >
> > I'm not sure how the controller driver could tell if there
> > was a connection or not: it doesn't operate these terms.
> > What the udc controller knows is: how to report bus reset
> > and how to receive or transmit the data...
>
> It seems I lied. Did you mean something like this patch?
>
> diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
> index c7de671..fd44cf4 100644
> --- a/drivers/usb/gadget/fsl_qe_udc.c
> +++ b/drivers/usb/gadget/fsl_qe_udc.c
> @@ -2368,6 +2368,9 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
> /* stop usb controller, disable intr */
> qe_usb_disable();
>
> + if (udc->usb_state == USB_STATE_DEFAULT)
Should be also || usb_state == USB_STATE_ATTACHED, since
this is the initial value after the usb_gadget_register_driver().
And the _DEFAULT state is "we're just after the bus reset" (also
means that we already called the disconnect()).
> + goto skip_quiesce;
> +
> /* in fact, no needed */
> udc_controller->usb_state = USB_STATE_ATTACHED;
> udc_controller->ep0_state = WAIT_FOR_SETUP;
> @@ -2385,6 +2388,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
> /* report disconnect; the driver is already quiesced */
> driver->disconnect(&udc_controller->gadget);
>
> +skip_quiesce:
> /* unbind gadget and unhook driver. */
> driver->unbind(&udc_controller->gadget);
> udc_controller->gadget.dev.driver = NULL;
--
Anton Vorontsov
email: cbouatmailru@gmail•com
irc://irc.freenode.net/bd2
next prev parent reply other threads:[~2008-11-12 20:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-12 18:56 [PATCH] usb/fsl_qe_udc: Report disconnect before unbinding Anton Vorontsov
2008-11-12 19:38 ` Alan Stern
2008-11-12 19:59 ` Anton Vorontsov
2008-11-12 20:12 ` Anton Vorontsov
2008-11-12 20:20 ` Anton Vorontsov [this message]
2008-11-12 21:12 ` Alan Stern
2008-11-13 11:57 ` [PATCH v2] " Anton Vorontsov
2008-11-18 1:01 ` David Brownell
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=20081112202017.GA5161@oksana.dev.rtsoft.ru \
--to=avorontsov@ru$(echo .)mvista.com \
--cc=dbrownell@users$(echo .)sourceforge.net \
--cc=greg@kroah$(echo .)com \
--cc=leoli@freescale$(echo .)com \
--cc=linux-usb@vger$(echo .)kernel.org \
--cc=linuxppc-dev@ozlabs$(echo .)org \
--cc=stern@rowland$(echo .)harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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