Felipe:

The documentation doesn't state whether a gadget driver's 
->disconnect() callback will be invoked when usb_gadget_disconnect() 
runs.  Probably the UDC drivers' behavior has changed over the years.

In any case, it's likely that various UDC drivers do behave
differently.  My current feeling is that ->disconnect() should be
invoked only when Vbus turns off, but I can't guarantee that all UDCs 
will do this.

How do you feel about documenting this ambiguity as in the patch below?
If you think this is okay, I'll submit it formally.

Alan Stern



Index: usb-4.x/drivers/usb/gadget/udc/core.c
===================================================================
--- usb-4.x.orig/drivers/usb/gadget/udc/core.c
+++ usb-4.x/drivers/usb/gadget/udc/core.c
@@ -672,6 +672,10 @@ EXPORT_SYMBOL_GPL(usb_gadget_connect);
  * as a disconnect (when a VBUS session is active).  Not all systems
  * support software pullup controls.
  *
+ * Whether or not the gadget driver's ->disconnect() callback will be
+ * invoked is undefined.  Gadget drivers should be prepared for either
+ * possibility.
+ *
  * Returns zero on success, else negative errno.
  */
 int usb_gadget_disconnect(struct usb_gadget *gadget)

--
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