UPSTREAM: usb: dwc3: gadget: add a per-endpoint request queue lock
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Wed, 13 Apr 2016 13:44:39 +0000 (16:44 +0300)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 16 Aug 2016 12:48:19 +0000 (20:48 +0800)
This will allow us to process several endpoints at a
time by making sure that we lock only shared
resources.

Change-Id: I87b6ffd1db1fbbdaeed30271b984918b5e0d9b6c
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 74674cbf858ff6a83c3f06f4ab0ffa5d3c91bf0b)

drivers/usb/dwc3/core.h
drivers/usb/dwc3/gadget.c

index a007b65413d3c984f85904431f929e0f8f0599d5..c07ea154a29d75b8f7f21a5ee78fec89b1962847 100644 (file)
@@ -480,6 +480,7 @@ struct dwc3_event_buffer {
  * @endpoint: usb endpoint
  * @pending_list: list of pending requests for this endpoint
  * @started_list: list of started requests on this endpoint
+ * @lock: spinlock for endpoint request queue traversal
  * @regs: pointer to first endpoint register
  * @trb_pool: array of transaction buffers
  * @trb_pool_dma: dma address of @trb_pool
@@ -502,6 +503,7 @@ struct dwc3_ep {
        struct list_head        pending_list;
        struct list_head        started_list;
 
+       spinlock_t              lock;
        void __iomem            *regs;
 
        struct dwc3_trb         *trb_pool;
index 6b2aaab35b0a084f7240eb8a40d6c9df08091466..89ff8dec20d8152cfed1f22d7e95da5e847e1f4d 100644 (file)
@@ -1849,6 +1849,7 @@ static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc,
                                (epnum & 1) ? "in" : "out");
 
                dep->endpoint.name = dep->name;
+               spin_lock_init(&dep->lock);
 
                dwc3_trace(trace_dwc3_gadget, "initializing %s", dep->name);