From 56d6361d9291eed6eb4511f63da57527247a1b8e Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Fri, 31 Jul 2015 09:12:31 +0000 Subject: [PATCH] Limit the number of times we loop inside the DWC OTG poll handler to avoid starving other fast interrupts. Fix a comment while at it. MFC after: 1 week Suggested by: Svatopluk Kraus --- sys/dev/usb/controller/dwc_otg.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/controller/dwc_otg.c b/sys/dev/usb/controller/dwc_otg.c index 51f083bc235d..bd3e51b91a20 100644 --- a/sys/dev/usb/controller/dwc_otg.c +++ b/sys/dev/usb/controller/dwc_otg.c @@ -2551,12 +2551,18 @@ static void dwc_otg_interrupt_poll_locked(struct dwc_otg_softc *sc) { struct usb_xfer *xfer; + uint32_t count = 0; uint32_t temp; uint8_t got_rx_status; uint8_t x; repeat: - /* get all channel interrupts */ + if (++count == 16) { + /* give other interrupts a chance */ + DPRINTF("Yield\n"); + return; + } + /* get all host channel interrupts */ for (x = 0; x != sc->sc_host_ch_max; x++) { temp = DWC_OTG_READ_4(sc, DOTG_HCINT(x)); if (temp != 0) {