On 9/7/2018 6:14 AM, Anurag Kumar Vulisha wrote: > According to dwc3 databook when streams are used, it may be possible > for the host and device become out of sync, where device may wait for > host to issue prime transcation and host may wait for device to issue > erdy. To avoid such deadlock, timeout needs to be implemented. After > timeout occurs, device will first stop transfer and restart the transfer > again. This patch does the same. > > Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xxxxxxxxxx> > Reviewed-by: Thinh Nguyen <thinhn@xxxxxxxxxxxx> > --- > Changes in v3: > 1. Added the changes suggested by "Thinh Nguyen" > > Changes in v2: > 1. Changed STREAM_TIMEOUT to STREAM_TIMEOUT_MS as suggested by > "Andy Shevchenko" > --- > drivers/usb/dwc3/core.h | 7 +++++++ > drivers/usb/dwc3/gadget.c | 36 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 43 insertions(+) > > diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h > index 5bfb625..0b255e97 100644 > --- a/drivers/usb/dwc3/core.h > +++ b/drivers/usb/dwc3/core.h > @@ -633,6 +633,11 @@ struct dwc3_event_buffer { > > #define DWC3_TRB_NUM 256 > > +/* > + * Timeout value in msecs used by stream_timeout_timer when streams are enabled > + */ > +#define STREAM_TIMEOUT_MS 50 > + > /** > * struct dwc3_ep - device side endpoint representation > * @endpoint: usb endpoint > @@ -656,6 +661,7 @@ struct dwc3_event_buffer { > * @name: a human readable name e.g. ep1out-bulk > * @direction: true for TX, false for RX > * @stream_capable: true when streams are enabled > + * @stream_timeout_timer: timer used to aviod deadlock when streams are used Change aviod -> avoid. Also, the timer is being used when there's a deadlock rather than to avoid it. You probably need to explain what deadlock it is if you mentioned it here, but I think it's ok to simply say timeout timer for streams (unless Felipe has any objection). Thinh