/* Same as for pxa_ep_enable, no physical endpoint configuration can be changed. Function flushes the endpoint and related requests.  */
static int pxa_ep_disable(struct usb_ep *_ep)
/* Same as for pxa_ep_enable, no physical endpoint configuration can be changed. Function flushes the endpoint and related requests.  */
static int pxa_ep_disable(struct usb_ep *_ep)
{
	struct pxa_ep		*ep;
	struct udc_usb_ep	*udc_usb_ep;
	unsigned long		flags;
	if (!_ep)
		return -EINVAL;
	udc_usb_ep = container_of(_ep, struct udc_usb_ep, usb_ep);
	ep = udc_usb_ep->pxa_ep;
	if (!ep || is_ep0(ep) || !list_empty(&ep->queue))
		return -EINVAL;
	spin_lock_irqsave(&ep->lock, flags);
	ep->enabled = 0;
	nuke(ep, -ESHUTDOWN);
	spin_unlock_irqrestore(&ep->lock, flags);
	pxa_ep_fifo_flush(_ep);
	udc_usb_ep->pxa_ep = NULL;
	ep_dbg(ep, "disabled\n");
	return 0;
}