usb: dwc3: gadget: use evt->length as we should
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 15 Nov 2016 11:05:23 +0000 (13:05 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 18 Nov 2016 11:54:43 +0000 (13:54 +0200)
Instead of always accessing the macro directly,
let's rely on evt->length which is the actual length
of current event buffer. While unlikely, we could
change event buffer's size at any time.

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

index 230ffa395dc3268c603699abc9cb34636c9658a6..304653fd9223a1c518584ff7673d351ee4a9b65c 100644 (file)
@@ -2834,7 +2834,7 @@ static irqreturn_t dwc3_process_event_buf(struct dwc3_event_buffer *evt)
                 * boundary so I worry about that once we try to handle
                 * that.
                 */
-               evt->lpos = (evt->lpos + 4) % DWC3_EVENT_BUFFERS_SIZE;
+               evt->lpos = (evt->lpos + 4) % evt->length;
                left -= 4;
 
                dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), 4);