On Wed, 6 Feb 2013, Felipe Balbi wrote:

> This is useful on gadgets that depend on userland
> daemons to function properly. We can delay connection
> to the host until userland is ready.

> --- a/drivers/usb/gadget/udc-core.c
> +++ b/drivers/usb/gadget/udc-core.c
> @@ -235,7 +235,18 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
>  
>       kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
>  
> -     usb_gadget_disconnect(udc->gadget);
> +     /*
> +      * NOTICE: if gadget driver wants to control
> +      * pullup, it needs to make sure that when
> +      * user tries to rmmod the gadget driver, it
> +      * will disconnect the pullups before returning
> +      * from its ->unbind() method.
> +      *
> +      * We are truly trusting the gadget driver here.
> +      */
> +     if (!udc->driver->controls_pullups)
> +             usb_gadget_disconnect(udc->gadget);

Even though you trust the gadget driver about when to enable the 
pullup, doesn't it make sense to disable the pullup whenever the gadget 
driver is removed, regardless?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to