From 9eaa3e95ebcbddd24e2f602a328b2d88f8e711bd Mon Sep 17 00:00:00 2001 From: jmatthew Date: Mon, 8 Jun 2015 00:46:33 +0000 Subject: [PATCH] Ensure polled bulk, control and interrupt transfers actually poll, fixing panics on shutdown with various usb sticks. ok mpi@ --- sys/dev/usb/dwc2/dwc2.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sys/dev/usb/dwc2/dwc2.c b/sys/dev/usb/dwc2/dwc2.c index 3cb30e2d902..09c2a2ce252 100644 --- a/sys/dev/usb/dwc2/dwc2.c +++ b/sys/dev/usb/dwc2/dwc2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2.c,v 1.25 2015/03/19 10:39:17 mpi Exp $ */ +/* $OpenBSD: dwc2.c,v 1.26 2015/06/08 00:46:33 jmatthew Exp $ */ /* $NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $ */ /*- @@ -1017,13 +1017,10 @@ dwc2_device_ctrl_start(struct usbd_xfer *xfer) err = dwc2_device_start(xfer); mtx_leave(&sc->sc_lock); - if (err) - return err; - if (sc->sc_bus.use_polling) dwc2_waitintr(sc, xfer); - return USBD_IN_PROGRESS; + return err; } STATIC void @@ -1086,6 +1083,9 @@ dwc2_device_bulk_start(struct usbd_xfer *xfer) err = dwc2_device_start(xfer); mtx_leave(&sc->sc_lock); + if (sc->sc_bus.use_polling) + dwc2_waitintr(sc, xfer); + return err; } @@ -1150,13 +1150,10 @@ dwc2_device_intr_start(struct usbd_xfer *xfer) err = dwc2_device_start(xfer); mtx_leave(&sc->sc_lock); - if (err) - return err; - if (sc->sc_bus.use_polling) dwc2_waitintr(sc, xfer); - return USBD_IN_PROGRESS; + return err; } /* Abort a device interrupt request. */ -- 2.20.1