summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHemant Kumar <hemantk@codeaurora.org>2017-01-23 16:07:20 -0800
committerHemant Kumar <hemantk@codeaurora.org>2017-01-23 16:23:55 -0800
commitbaaba9bc36a5df26544f0430b47600494066138d (patch)
tree6c35e07e6871fc01f283fe3b7b7859053f6e5ed1
parent1f1d94408446043289fe0126897f98af2dce0ecd (diff)
usb: gadget: f_mass_storage: Add delay before continuing status stage
There is a possibility of race between ep0 setup phase completion handler and mass storage thread. Upon set_alt if thread gets a chance to run before dwc3_ep0_delegate_req() returns USB_GADGET_DELAYED_STATUS and sets delayed_status flag to true status phase request never gets queued. This results into device enumeration failure followed by a bus resets. Fix this issue by adding delay before calling usb_composite_setup_continue() to queue the status phase request. Change-Id: Iec6cf668053af310be5171d19d204fb452e01f2a Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
-rw-r--r--drivers/usb/gadget/function/f_mass_storage.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index f3715d85aedc..7368a31e6268 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -2471,8 +2471,14 @@ static void handle_exception(struct fsg_common *common)
case FSG_STATE_CONFIG_CHANGE:
do_set_interface(common, common->new_fsg);
- if (common->new_fsg)
+ if (common->new_fsg) {
+ /*
+ * make sure delayed_status flag updated when set_alt
+ * returned.
+ */
+ msleep(200);
usb_composite_setup_continue(common->cdev);
+ }
break;
case FSG_STATE_EXIT: