Skip to content

Commit

Permalink
usb: gadget: Introduce usb_gadget_giveback_request()
Browse files Browse the repository at this point in the history
All USB peripheral controller drivers call completion routines directly.
This patch adds usb_gadget_giveback_request() which will be used instead
of direct invocation in the next patch. The goal here is to have a place
where common functionality can be added.

Signed-off-by: Michal Sojka <sojka@merica.cz>
Acked-by: Felipe Balbi <balbi@ti.com>
Tested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Michal Sojka authored and Greg Kroah-Hartman committed Sep 25, 2014
1 parent 1b59fc7 commit 3fc2aa5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drivers/usb/gadget/udc/udc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,22 @@ EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);

/* ------------------------------------------------------------------------- */

/**
* usb_gadget_giveback_request - give the request back to the gadget layer
* Context: in_interrupt()
*
* This is called by device controller drivers in order to return the
* completed request back to the gadget layer.
*/
void usb_gadget_giveback_request(struct usb_ep *ep,
struct usb_request *req)
{
req->complete(ep, req);
}
EXPORT_SYMBOL_GPL(usb_gadget_giveback_request);

/* ------------------------------------------------------------------------- */

static void usb_gadget_state_work(struct work_struct *work)
{
struct usb_gadget *gadget = work_to_gadget(work);
Expand Down
8 changes: 8 additions & 0 deletions include/linux/usb/gadget.h
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,14 @@ extern void usb_gadget_udc_reset(struct usb_gadget *gadget,

/*-------------------------------------------------------------------------*/

/* utility to give requests back to the gadget layer */

extern void usb_gadget_giveback_request(struct usb_ep *ep,
struct usb_request *req);


/*-------------------------------------------------------------------------*/

/* utility wrapping a simple endpoint selection policy */

extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
Expand Down

0 comments on commit 3fc2aa5

Please sign in to comment.