]> git.sur5r.net Git - u-boot/commitdiff
usb: dwc3: optimize interrupt loop
authorMarek Szyprowski <m.szyprowski@samsung.com>
Tue, 3 Mar 2015 16:32:12 +0000 (17:32 +0100)
committerMarek Vasut <marex@denx.de>
Tue, 14 Apr 2015 03:48:12 +0000 (05:48 +0200)
There is no point in calling dwc3_thread_interrupt() if no event is
pending. There is also no point in flushing event cache in EVERY loop
iteration.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
drivers/usb/dwc3/core.c
drivers/usb/dwc3/gadget.c

index 33d2cf2f112df2488fb49936494399dcc12b4ebe..ab3c94e51275764df2e8b965329de604cc3d32e7 100644 (file)
@@ -769,18 +769,11 @@ void dwc3_uboot_exit(int index)
 void dwc3_uboot_handle_interrupt(int index)
 {
        struct dwc3 *dwc = NULL;
-       int i;
-       struct dwc3_event_buffer *evt;
 
        list_for_each_entry(dwc, &dwc3_list, list) {
                if (dwc->index != index)
                        continue;
 
-               for (i = 0; i < dwc->num_event_buffers; i++) {
-                       evt = dwc->ev_buffs[i];
-                       dwc3_flush_cache((int)evt->buf, evt->length);
-               }
-
                dwc3_gadget_uboot_handle_interrupt(dwc);
                break;
        }
index 7c342c63ec67097cab6b77873df8d240bd08863b..eb31cd93d622a5a6550afd9c5eb153fb761c0c3b 100644 (file)
@@ -2683,6 +2683,17 @@ void dwc3_gadget_exit(struct dwc3 *dwc)
  */
 void dwc3_gadget_uboot_handle_interrupt(struct dwc3 *dwc)
 {
-       dwc3_interrupt(0, dwc);
-       dwc3_thread_interrupt(0, dwc);
+       int ret = dwc3_interrupt(0, dwc);
+
+       if (ret == IRQ_WAKE_THREAD) {
+               int i;
+               struct dwc3_event_buffer *evt;
+
+               for (i = 0; i < dwc->num_event_buffers; i++) {
+                       evt = dwc->ev_buffs[i];
+                       dwc3_flush_cache((int)evt->buf, evt->length);
+               }
+
+               dwc3_thread_interrupt(0, dwc);
+       }
 }