Re: [PATCH v3 1/2] usb: gadget: Refactor request completion

From: Alan Stern
Date: Wed Aug 27 2014 - 11:03:10 EST


On Wed, 27 Aug 2014, Michal Sojka wrote:

> All USB peripheral controller drivers called completion routines
> directly. This patch moves the completion call from drivers to
> usb_gadget_giveback_request(), in order to have a place where common
> functionality can be added.
>
> All places in drivers/usb/ matching "[-.]complete(" were replaced with a
> call to usb_gadget_giveback_request(). This was compile-tested with all
> ARM drivers enabled and runtime-tested for musb.


> --- a/drivers/usb/gadget/udc/udc-core.c
> +++ b/drivers/usb/gadget/udc/udc-core.c
> @@ -102,6 +102,15 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget,
> }
> EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);
>
> +void usb_gadget_giveback_request(struct usb_ep *ep,
> + struct usb_request *req)
> +{
> + /* complete() is from gadget layer,
> + * eg fsg->bulk_in_complete() */

Wrong format for a multi-line comment. It should look like this:

/*
* Blah, blah, blah
* blah, blah, blah
*/

Also, the reference to fsg is obsolete; the File-backed Storage Gadget
is no longer in the kernel. You might as well leave the comment out
entirely.

> + if (req->complete)

This test shouldn't be here. The UDC drivers don't do it, but they
probably do check the req->complete isn't NULL when the request is
submitted. In any case, if req->complete is NULL then we want to know
about it because it is a bug. It should not be covered up silently.

> + req->complete(ep, req);
> +}
> +EXPORT_SYMBOL_GPL(usb_gadget_giveback_request);
> #endif /* CONFIG_HAS_DMA */

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/