BZ: 37568
after disconnecting pullup, any flying request should be completed or
any potential request should be added within 50ms. 50ms should be enough
considering the interrupt maximun interval. so sleeping for 50ms and
dequeuing ep0 should be able to cleanup the request in ep0.
Change-Id: I9e131cd1217ec748be7a013894ce7c63ef4214a3
Signed-off-by: jzhuan5 <jin.can.zhuang@intel.com>
Reviewed-on: http://android.intel.com:8080/50022
Reviewed-by: Tang, Richard <richard.tang@intel.com>
Reviewed-by: Wu, Hao <hao.wu@intel.com>
Reviewed-by: Meng, Zhe <zhe.meng@intel.com>
Tested-by: Meng, Zhe <zhe.meng@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
dev->enabled = true;
} else if (!enabled && dev->enabled) {
usb_gadget_disconnect(cdev->gadget);
+
+ /* As connection is disconnected here,
+ * any flying request should be completed or potential
+ * request should be added within 50ms.
+ */
+ msleep(50);
+
/* Cancel pending control requests */
usb_ep_dequeue(cdev->gadget->ep0, cdev->req);
usb_remove_config(cdev, &android_config_driver);
{
unsigned long flags;
- /* As connection is disconnected here,
- * if there's no request on ep0IN, no more request completion
- * will happen on ep0IN.
- * otherwise, there's one request on ep0IN, let's wait until
- * it's completed! 50 ms should be more than enough.
- */
- msleep(50);
-
spin_lock_irqsave(&cdev->lock, flags);
if (cdev->config == config)