aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@freescale.com>2015-02-10 23:44:41 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-18 11:19:08 -0400
commitd5d1e1bed4da02bd7a2352ab495721e31a7d95e4 (patch)
tree45ef387ea924d329c4ae701de0fc8369a811607f
parent9eccca0843205f87c00404b663188b88eb248051 (diff)
usb: chipidea: udc: return immediately if re-enable non-empty endpoint
Some gadget driver (like uac1) will try to enable endpoint again even the ep is not empty, it will cause the ep reset again and may affect the dTD list which has already queued. It returns -EBUSY immediately, and indicate the endpoint is in use. In this way, the ep's behavior will not be affected, and the gadget driver is also notified. Cc: Xuebing Wang <xbing6@gmail.com> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/chipidea/udc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index ff451048c1ac..52445428f254 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1151,10 +1151,13 @@ static int ep_enable(struct usb_ep *ep,
1151 1151
1152 /* only internal SW should enable ctrl endpts */ 1152 /* only internal SW should enable ctrl endpts */
1153 1153
1154 hwep->ep.desc = desc; 1154 if (!list_empty(&hwep->qh.queue)) {
1155
1156 if (!list_empty(&hwep->qh.queue))
1157 dev_warn(hwep->ci->dev, "enabling a non-empty endpoint!\n"); 1155 dev_warn(hwep->ci->dev, "enabling a non-empty endpoint!\n");
1156 spin_unlock_irqrestore(hwep->lock, flags);
1157 return -EBUSY;
1158 }
1159
1160 hwep->ep.desc = desc;
1158 1161
1159 hwep->dir = usb_endpoint_dir_in(desc) ? TX : RX; 1162 hwep->dir = usb_endpoint_dir_in(desc) ? TX : RX;
1160 hwep->num = usb_endpoint_num(desc); 1163 hwep->num = usb_endpoint_num(desc);