diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2019-10-06 17:30:01 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2019-10-06 17:30:01 +0000 |
commit | 599442ca90eff8996fb983087a4607cbccdb5d14 (patch) | |
tree | deb0d2841e2dd8e2a8b40842c0a43bfa0288af2d /sys/dev/usb | |
parent | 6d1313405c29b592524391f67ba33560af0007f5 (diff) |
Use MSEC_TO_NSEC() to define XHCI_CMD_TIMEOUT & use it w/ tsleep_nsec(9).
ok visa@, kn@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/xhci.c | 7 | ||||
-rw-r--r-- | sys/dev/usb/xhcivar.h | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c index 761ca42c6ea..f9d7eb3a401 100644 --- a/sys/dev/usb/xhci.c +++ b/sys/dev/usb/xhci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xhci.c,v 1.105 2019/06/13 21:03:48 mpi Exp $ */ +/* $OpenBSD: xhci.c,v 1.106 2019/10/06 17:30:00 mpi Exp $ */ /* * Copyright (c) 2014-2015 Martin Pieuchot @@ -1804,8 +1804,7 @@ xhci_command_submit(struct xhci_softc *sc, struct xhci_trb *trb0, int timeout) s = splusb(); sc->sc_cmd_trb = trb; XDWRITE4(sc, XHCI_DOORBELL(0), 0); - error = tsleep(&sc->sc_cmd_trb, PZERO, "xhcicmd", - (timeout*hz+999)/ 1000 + 1); + error = tsleep_nsec(&sc->sc_cmd_trb, PZERO, "xhcicmd", timeout); if (error) { #ifdef XHCI_DEBUG printf("%s: tsleep() = %d\n", __func__, error); @@ -2219,7 +2218,7 @@ xhci_abort_xfer(struct usbd_xfer *xfer, usbd_status status) */ xhci_cmd_set_tr_deq_async(sc, xp->slot, xp->dci, DEQPTR(xp->ring) | xp->ring.toggle); - error = tsleep(xp, PZERO, "xhciab", (XHCI_CMD_TIMEOUT*hz+999)/1000 + 1); + error = tsleep_nsec(xp, PZERO, "xhciab", XHCI_CMD_TIMEOUT); if (error) printf("%s: timeout aborting transfer\n", DEVNAME(sc)); } diff --git a/sys/dev/usb/xhcivar.h b/sys/dev/usb/xhcivar.h index dfff7c31efe..dc2e86da335 100644 --- a/sys/dev/usb/xhcivar.h +++ b/sys/dev/usb/xhcivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xhcivar.h,v 1.10 2018/09/05 14:03:28 mpi Exp $ */ +/* $OpenBSD: xhcivar.h,v 1.11 2019/10/06 17:30:00 mpi Exp $ */ /* * Copyright (c) 2014 Martin Pieuchot @@ -20,7 +20,7 @@ #define _XHCIVAR_H_ /* Default command execution time (implementation defined). */ -#define XHCI_CMD_TIMEOUT 500 /* ms */ +#define XHCI_CMD_TIMEOUT MSEC_TO_NSEC(500) #define XHCI_MAX_CMDS (16 * 1) #define XHCI_MAX_EVTS (16 * 13) |