linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v7,03/10] usb: dwc3: gadget: handle stream events
@ 2018-12-01 11:13 Anurag Kumar Vulisha
  0 siblings, 0 replies; only message in thread
From: Anurag Kumar Vulisha @ 2018-12-01 11:13 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Shuah Khan, Alan Stern,
	Johan Hovold, Jaejoong Kim, Benjamin Herrenschmidt,
	Roger Quadros, Manu Gautam, martin.petersen, Bart Van Assche,
	Mike Christie, Matthew Wilcox, Colin Ian King
  Cc: linux-usb, linux-kernel, v.anuragkumar, Thinh Nguyen,
	Tejas Joglekar, Ajay Yugalkishore Pandey, Anurag Kumar Vulisha

When bulk streams are enabled, the udc/core.c starts
the timer for every request queued. This timer needs
to be deleted by the gadget driver when a valid stream
event is found. This is done to avoid the deadlock
situation which occurs when streams are enabled. This
patch modifies the code to delete the pending timer for
the request matching the streamid found in the event.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
---
 Changes in v7:
	1. This patch is newly added into this series
---
 drivers/usb/dwc3/gadget.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 9faad89..319a3ed 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2438,6 +2438,28 @@ static void dwc3_gadget_endpoint_transfer_not_ready(struct dwc3_ep *dep,
 	__dwc3_gadget_start_isoc(dep);
 }
 
+static void dwc3_endpoint_stream_event(struct dwc3 *dwc,
+				       const struct dwc3_event_depevt *event)
+{
+	struct dwc3_ep		*dep;
+	struct dwc3_request	*req;
+	u8			epnum = event->endpoint_number;
+	u8			stream_id;
+
+	dep = dwc->eps[epnum];
+
+	stream_id = event->parameters;
+
+	/* Check for request matching the streamid and delete the timer */
+	list_for_each_entry(req, &dep->started_list, list) {
+		if (req->request.stream_id == stream_id) {
+			if (timer_pending(&req->request.req_timeout_timer))
+				del_timer(&req->request.req_timeout_timer);
+			break;
+		}
+	}
+}
+
 static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
 		const struct dwc3_event_depevt *event)
 {
@@ -2477,6 +2499,9 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
 		}
 		break;
 	case DWC3_DEPEVT_STREAMEVT:
+		if (event->status == DEPEVT_STREAMEVT_FOUND)
+			dwc3_endpoint_stream_event(dwc, event);
+
 	case DWC3_DEPEVT_XFERCOMPLETE:
 	case DWC3_DEPEVT_RXTXFIFOEVT:
 		break;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-01 11:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-01 11:13 [v7,03/10] usb: dwc3: gadget: handle stream events Anurag Kumar Vulisha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).