[PATCH] usb/fsl_qe_udc: Report disconnect before unbinding

Alan Stern stern at rowland.harvard.edu
Thu Nov 13 06:38:02 EST 2008


On Wed, 12 Nov 2008, Anton Vorontsov wrote:

> Gadgets disable endpoints in their disconnect callbacks, so
> we must call disconnect before unbinding. This also fixes
> muram memory leak, since we free muram in the qe_ep_disable().

> --- a/drivers/usb/gadget/fsl_qe_udc.c
> +++ b/drivers/usb/gadget/fsl_qe_udc.c
> @@ -2382,6 +2382,9 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
>  		nuke(loop_ep, -ESHUTDOWN);
>  	spin_unlock_irqrestore(&udc_controller->lock, flags);
>  
> +	/* report disconnect; the driver is already quiesced */
> +	driver->disconnect(&udc_controller->gadget);
> +
>  	/* unbind gadget and unhook driver. */
>  	driver->unbind(&udc_controller->gadget);
>  	udc_controller->gadget.dev.driver = NULL;

Wouldn't it be better to do this before nuking the existing requests?  
The comment is wrong; the gadget driver is _not_ quiesced at this
point.  In fact the disconnect call is what quiesces the driver!

And wouldn't it be better to _skip_ doing this if the gadget wasn't 
connected before?

Alan Stern




More information about the Linuxppc-dev mailing list