Commit bf594c10 authored by Alan Stern's avatar Alan Stern Committed by Felipe Balbi

USB: gadget: Document that certain ep operations can be called in interrupt context

This documentation patch specifies that certain USB gadget endpoint
operations may be called in interrupt context:

	usb_ep_queue, usb_ep_dequeue, usb_ep_set_halt,
	usb_ep_clear_halt, usb_ep_set_wedge, usb_ep_fifo_status,
	and usb_ep_fifo_flush;

while others must be called in process context:

	usb_ep_enable and usb_ep_disable.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent ad22a666
...@@ -87,6 +87,8 @@ EXPORT_SYMBOL_GPL(usb_ep_set_maxpacket_limit); ...@@ -87,6 +87,8 @@ EXPORT_SYMBOL_GPL(usb_ep_set_maxpacket_limit);
* configurable, with more generic names like "ep-a". (remember that for * configurable, with more generic names like "ep-a". (remember that for
* USB, "in" means "towards the USB master".) * USB, "in" means "towards the USB master".)
* *
* This routine must be called in process context.
*
* returns zero, or a negative error code. * returns zero, or a negative error code.
*/ */
int usb_ep_enable(struct usb_ep *ep) int usb_ep_enable(struct usb_ep *ep)
...@@ -119,6 +121,8 @@ EXPORT_SYMBOL_GPL(usb_ep_enable); ...@@ -119,6 +121,8 @@ EXPORT_SYMBOL_GPL(usb_ep_enable);
* gadget drivers must call usb_ep_enable() again before queueing * gadget drivers must call usb_ep_enable() again before queueing
* requests to the endpoint. * requests to the endpoint.
* *
* This routine must be called in process context.
*
* returns zero, or a negative error code. * returns zero, or a negative error code.
*/ */
int usb_ep_disable(struct usb_ep *ep) int usb_ep_disable(struct usb_ep *ep)
...@@ -241,6 +245,8 @@ EXPORT_SYMBOL_GPL(usb_ep_free_request); ...@@ -241,6 +245,8 @@ EXPORT_SYMBOL_GPL(usb_ep_free_request);
* Note that @req's ->complete() callback must never be called from * Note that @req's ->complete() callback must never be called from
* within usb_ep_queue() as that can create deadlock situations. * within usb_ep_queue() as that can create deadlock situations.
* *
* This routine may be called in interrupt context.
*
* Returns zero, or a negative error code. Endpoints that are not enabled * Returns zero, or a negative error code. Endpoints that are not enabled
* report errors; errors will also be * report errors; errors will also be
* reported when the usb peripheral is disconnected. * reported when the usb peripheral is disconnected.
...@@ -284,6 +290,8 @@ EXPORT_SYMBOL_GPL(usb_ep_queue); ...@@ -284,6 +290,8 @@ EXPORT_SYMBOL_GPL(usb_ep_queue);
* at the head of the queue) except as part of disconnecting from usb. Such * at the head of the queue) except as part of disconnecting from usb. Such
* restrictions prevent drivers from supporting configuration changes, * restrictions prevent drivers from supporting configuration changes,
* even to configuration zero (a "chapter 9" requirement). * even to configuration zero (a "chapter 9" requirement).
*
* This routine may be called in interrupt context.
*/ */
int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req) int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
{ {
...@@ -311,6 +319,8 @@ EXPORT_SYMBOL_GPL(usb_ep_dequeue); ...@@ -311,6 +319,8 @@ EXPORT_SYMBOL_GPL(usb_ep_dequeue);
* current altsetting, see usb_ep_clear_halt(). When switching altsettings, * current altsetting, see usb_ep_clear_halt(). When switching altsettings,
* it's simplest to use usb_ep_enable() or usb_ep_disable() for the endpoints. * it's simplest to use usb_ep_enable() or usb_ep_disable() for the endpoints.
* *
* This routine may be called in interrupt context.
*
* Returns zero, or a negative error code. On success, this call sets * Returns zero, or a negative error code. On success, this call sets
* underlying hardware state that blocks data transfers. * underlying hardware state that blocks data transfers.
* Attempts to halt IN endpoints will fail (returning -EAGAIN) if any * Attempts to halt IN endpoints will fail (returning -EAGAIN) if any
...@@ -336,6 +346,8 @@ EXPORT_SYMBOL_GPL(usb_ep_set_halt); ...@@ -336,6 +346,8 @@ EXPORT_SYMBOL_GPL(usb_ep_set_halt);
* for endpoints that aren't reconfigured, after clearing any other state * for endpoints that aren't reconfigured, after clearing any other state
* in the endpoint's i/o queue. * in the endpoint's i/o queue.
* *
* This routine may be called in interrupt context.
*
* Returns zero, or a negative error code. On success, this call clears * Returns zero, or a negative error code. On success, this call clears
* the underlying hardware state reflecting endpoint halt and data toggle. * the underlying hardware state reflecting endpoint halt and data toggle.
* Note that some hardware can't support this request (like pxa2xx_udc), * Note that some hardware can't support this request (like pxa2xx_udc),
...@@ -360,6 +372,8 @@ EXPORT_SYMBOL_GPL(usb_ep_clear_halt); ...@@ -360,6 +372,8 @@ EXPORT_SYMBOL_GPL(usb_ep_clear_halt);
* requests. If the gadget driver clears the halt status, it will * requests. If the gadget driver clears the halt status, it will
* automatically unwedge the endpoint. * automatically unwedge the endpoint.
* *
* This routine may be called in interrupt context.
*
* Returns zero on success, else negative errno. * Returns zero on success, else negative errno.
*/ */
int usb_ep_set_wedge(struct usb_ep *ep) int usb_ep_set_wedge(struct usb_ep *ep)
...@@ -388,6 +402,8 @@ EXPORT_SYMBOL_GPL(usb_ep_set_wedge); ...@@ -388,6 +402,8 @@ EXPORT_SYMBOL_GPL(usb_ep_set_wedge);
* written OUT to it by the host. Drivers that need precise handling for * written OUT to it by the host. Drivers that need precise handling for
* fault reporting or recovery may need to use this call. * fault reporting or recovery may need to use this call.
* *
* This routine may be called in interrupt context.
*
* This returns the number of such bytes in the fifo, or a negative * This returns the number of such bytes in the fifo, or a negative
* errno if the endpoint doesn't use a FIFO or doesn't support such * errno if the endpoint doesn't use a FIFO or doesn't support such
* precise handling. * precise handling.
...@@ -415,6 +431,8 @@ EXPORT_SYMBOL_GPL(usb_ep_fifo_status); ...@@ -415,6 +431,8 @@ EXPORT_SYMBOL_GPL(usb_ep_fifo_status);
* an endpoint fifo after abnormal transaction terminations. The call * an endpoint fifo after abnormal transaction terminations. The call
* must never be used except when endpoint is not being used for any * must never be used except when endpoint is not being used for any
* protocol translation. * protocol translation.
*
* This routine may be called in interrupt context.
*/ */
void usb_ep_fifo_flush(struct usb_ep *ep) void usb_ep_fifo_flush(struct usb_ep *ep)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment