]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
usb: dwc3: gadget: introduce cancelled_list
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Wed, 1 Aug 2018 10:53:29 +0000 (13:53 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 26 Nov 2018 07:08:29 +0000 (09:08 +0200)
This list will host cancelled requests who still have TRBs being
processed.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/core.h
drivers/usb/dwc3/gadget.c
drivers/usb/dwc3/gadget.h

index 8405519413a443372e3467a296bcf81bf459dc85..9798c73c09ce1012e276c6d506b4e1e0bea3fd1a 100644 (file)
@@ -646,6 +646,7 @@ struct dwc3_event_buffer {
 /**
  * struct dwc3_ep - device side endpoint representation
  * @endpoint: usb endpoint
+ * @cancelled_list: list of cancelled requests for this endpoint
  * @pending_list: list of pending requests for this endpoint
  * @started_list: list of started requests on this endpoint
  * @wait_end_transfer: wait_queue_head_t for waiting on End Transfer complete
@@ -673,6 +674,7 @@ struct dwc3_event_buffer {
  */
 struct dwc3_ep {
        struct usb_ep           endpoint;
+       struct list_head        cancelled_list;
        struct list_head        pending_list;
        struct list_head        started_list;
 
index 9728978070b7d3003e2d48d554bb60919bf8fbe5..17203944d77f7fda7f566b508f6d11d649da2337 100644 (file)
@@ -2284,6 +2284,7 @@ static int dwc3_gadget_init_endpoint(struct dwc3 *dwc, u8 epnum)
 
        INIT_LIST_HEAD(&dep->pending_list);
        INIT_LIST_HEAD(&dep->started_list);
+       INIT_LIST_HEAD(&dep->cancelled_list);
 
        return 0;
 }
index 2aacd1afd9ff0eac2b668166f3a202f649ea3400..023a473648eb77ddc36c5921a8a339a4d5c49817 100644 (file)
@@ -79,6 +79,21 @@ static inline void dwc3_gadget_move_started_request(struct dwc3_request *req)
        list_move_tail(&req->list, &dep->started_list);
 }
 
+/**
+ * dwc3_gadget_move_cancelled_request - move @req to the cancelled_list
+ * @req: the request to be moved
+ *
+ * Caller should take care of locking. This function will move @req from its
+ * current list to the endpoint's cancelled_list.
+ */
+static inline void dwc3_gadget_move_cancelled_request(struct dwc3_request *req)
+{
+       struct dwc3_ep          *dep = req->dep;
+
+       req->started = false;
+       list_move_tail(&req->list, &dep->cancelled_list);
+}
+
 void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
                int status);