From: mpi Date: Wed, 21 Jan 2015 14:02:33 +0000 (+0000) Subject: Do not try to stop and reset endpoints if USB transfers are aborted X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7ff307ae954db12cebe37bdf6861a1cc9696014e;p=openbsd Do not try to stop and reset endpoints if USB transfers are aborted because the HC has been shut down (during suspend/hibernate) or removed (PCIe card). In both cases the hardware wont complete the commands, resulting in timeouts. Instead just do the software part of the abort process. Unbreak suspend/resume with USB a device connected to xhci(4) as reported by Fabian Raetz on bugs@. --- diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c index d0e725097fc..774bd87b759 100644 --- a/sys/dev/usb/xhci.c +++ b/sys/dev/usb/xhci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xhci.c,v 1.57 2015/01/18 20:35:11 mpi Exp $ */ +/* $OpenBSD: xhci.c,v 1.58 2015/01/21 14:02:33 mpi Exp $ */ /* * Copyright (c) 2014-2015 Martin Pieuchot @@ -1912,8 +1912,10 @@ xhci_abort_xfer(struct usbd_xfer *xfer, usbd_status status) xfer->actlen, xfer->length, ((struct xhci_xfer *)xfer)->index)); /* XXX The stack should not call abort() in this case. */ - if (xfer->status == USBD_NOT_STARTED) { + if (sc->sc_bus.dying || xfer->status == USBD_NOT_STARTED) { xfer->status = status; + timeout_del(&xfer->timeout_handle); + usb_rem_task(xfer->device, &xfer->abort_task); usb_transfer_complete(xfer); return; }