Skip to contentSkip to conversation

usb: gadget: udc: core: Document the relation between usb_ep_queue() and completion callback

DISCUSSION Felipe Balbi 1 participant 1 message Mar 28, 2018 USB

lore
Share & tools
lore

Felipe Balbi

author Acked-by
#0 lore raw

Hi,

Quoted 10 lines · Alan Stern

Improve the kerneldoc for usb_ep_queue() to note explicitly that the request's completion routine will be called if and only if the return value is 0. The corresponding fact about usb_submit_urb() for the host-side API has long been documented, and this has always been the intention for the gadget API. But until now, documentation seems to have been lacking.

---

Greg, I have this queued up for v4.18 already, but if you wanna take it forward on v4.17 it's fine by me.

Quoted 25 lines
 drivers/usb/gadget/udc/core.c |    6 ++++++
 1 file changed, 6 insertions(+)

Index: usb-4.x/drivers/usb/gadget/udc/core.c
===================================================================

drivers/usb/gadget/udc/core.c +6 -1
@@ -241,6 +241,12 @@ EXPORT_SYMBOL_GPL(usb_ep_free_request);
  * Returns zero, or a negative error code.  Endpoints that are not enabled
  * report errors; errors will also be
  * reported when the usb peripheral is disconnected.
+ *
+ * If and only if @req is successfully queued (the return value is zero),
+ * @req->complete() will be called exactly once, when the Gadget core and
+ * UDC are finished with the request.  When the completion function is called,
+ * control of the request is returned to the device driver which submitted it.
+ * The completion handler may then immediately free or reuse @req.
  */
 int usb_ep_queue(struct usb_ep *ep,
 			       struct usb_request *req, gfp_t gfp_flags)
 
--

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