]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
usb: dwc3: gadget: remove DWC3_EP_END_TRANSFER_PENDING
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 21 Jan 2019 11:08:44 +0000 (13:08 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 4 Feb 2019 06:46:22 +0000 (08:46 +0200)
Now that we modified the code to fix a race condition, it's clear that
DWC3_EP_END_TRANSFER_PENDING is unnecessary, considering that
DWC3_EP_TRANSFER_STARTED will remain set until End Transfer completes.

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

index 96794c301a6b819e8e338a110ca39ddb729f1798..1528d395b156e2db6bd6002985b7976d8627b09e 100644 (file)
@@ -692,7 +692,6 @@ struct dwc3_ep {
 #define DWC3_EP_WEDGE          BIT(2)
 #define DWC3_EP_TRANSFER_STARTED BIT(3)
 #define DWC3_EP_PENDING_REQUEST        BIT(5)
-#define DWC3_EP_END_TRANSFER_PENDING   BIT(7)
 
        /* This last one is specific to EP0 */
 #define DWC3_EP0_DIR_IN                BIT(31)
index b82a8885747d6b99f515ee450050346312de2b99..8425b6dab875e97e2edc61cdd85fc103bb261ad2 100644 (file)
@@ -632,7 +632,6 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action)
 
                dep->type = usb_endpoint_type(desc);
                dep->flags |= DWC3_EP_ENABLED;
-               dep->flags &= ~DWC3_EP_END_TRANSFER_PENDING;
 
                reg = dwc3_readl(dwc->regs, DWC3_DALEPENA);
                reg |= DWC3_DALEPENA_EP(dep->number);
@@ -738,7 +737,7 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep)
 
        dep->stream_capable = false;
        dep->type = 0;
-       dep->flags &= DWC3_EP_END_TRANSFER_PENDING;
+       dep->flags = 0;
 
        /* Clear out the ep descriptors for non-ep0 */
        if (dep->number > 1) {
@@ -2548,7 +2547,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
        dep = dwc->eps[epnum];
 
        if (!(dep->flags & DWC3_EP_ENABLED)) {
-               if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING))
+               if (!(dep->flags & DWC3_EP_TRANSFER_STARTED))
                        return;
 
                /* Handle only EPCMDCMPLT when EP disabled */
@@ -2572,8 +2571,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
                cmd = DEPEVT_PARAMETER_CMD(event->parameters);
 
                if (cmd == DWC3_DEPCMD_ENDTRANSFER) {
-                       dep->flags &= ~(DWC3_EP_END_TRANSFER_PENDING |
-                                       DWC3_EP_TRANSFER_STARTED);
+                       dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
                        dwc3_gadget_ep_cleanup_cancelled_requests(dep);
                }
                break;
@@ -2630,8 +2628,7 @@ static void dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force)
        u32 cmd;
        int ret;
 
-       if ((dep->flags & DWC3_EP_END_TRANSFER_PENDING)
-               || !(dep->flags & DWC3_EP_TRANSFER_STARTED))
+       if (!(dep->flags & DWC3_EP_TRANSFER_STARTED))
                return;
 
        /*
@@ -2674,10 +2671,8 @@ static void dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force)
        WARN_ON_ONCE(ret);
        dep->resource_index = 0;
 
-       if (dwc3_is_usb31(dwc) || dwc->revision < DWC3_REVISION_310A) {
-               dep->flags |= DWC3_EP_END_TRANSFER_PENDING;
+       if (dwc3_is_usb31(dwc) || dwc->revision < DWC3_REVISION_310A)
                udelay(100);
-       }
 }
 
 static void dwc3_clear_stall_all_ep(struct dwc3 *dwc)
index e97a00593dda79c8dd7c4849c5ee459b2225311d..3a2f2c319c9ab466d7011d58633aa79988de2b2e 100644 (file)
@@ -305,7 +305,7 @@ DECLARE_EVENT_CLASS(dwc3_log_ep,
                __entry->trb_enqueue = dep->trb_enqueue;
                __entry->trb_dequeue = dep->trb_dequeue;
        ),
-       TP_printk("%s: mps %d/%d streams %d burst %d ring %d/%d flags %c:%c%c%c%c:%c:%c",
+       TP_printk("%s: mps %d/%d streams %d burst %d ring %d/%d flags %c:%c%c%c%c:%c",
                __get_str(name), __entry->maxpacket,
                __entry->maxpacket_limit, __entry->max_streams,
                __entry->maxburst, __entry->trb_enqueue,
@@ -315,7 +315,6 @@ DECLARE_EVENT_CLASS(dwc3_log_ep,
                __entry->flags & DWC3_EP_WEDGE ? 'W' : 'w',
                __entry->flags & DWC3_EP_TRANSFER_STARTED ? 'B' : 'b',
                __entry->flags & DWC3_EP_PENDING_REQUEST ? 'P' : 'p',
-               __entry->flags & DWC3_EP_END_TRANSFER_PENDING ? 'E' : 'e',
                __entry->direction ? '<' : '>'
        )
 );