summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2013-11-09 08:46:06 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2013-11-09 08:46:06 +0000
commit4aba4ce33baf3a477585033e9fcecd9710d31758 (patch)
treead10c2374c3943ae6fa9872f094bdd43abb61a79
parent3c4a62bc68f80657362a71d785beb53f5a3f27a4 (diff)
In our USB world, timeouts are in milliseconds, so use timeout_add_msec()
coherently through all our controller drivers and kill the mstohz() macro. ok pirofti@
-rw-r--r--sys/dev/usb/ehci.c4
-rw-r--r--sys/dev/usb/ohci.c8
-rw-r--r--sys/dev/usb/uhci.c12
3 files changed, 9 insertions, 15 deletions
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c
index 7b15b6dd629..48512b64424 100644
--- a/sys/dev/usb/ehci.c
+++ b/sys/dev/usb/ehci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ehci.c,v 1.137 2013/11/09 08:40:32 mpi Exp $ */
+/* $OpenBSD: ehci.c,v 1.138 2013/11/09 08:46:05 mpi Exp $ */
/* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */
/*
@@ -87,8 +87,6 @@ int ehcidebug = 0;
#define DPRINTFN(n,x)
#endif
-#define mstohz(ms) ((ms) * hz / 1000)
-
struct ehci_pipe {
struct usbd_pipe pipe;
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index b71cfdfa834..765be602881 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci.c,v 1.115 2013/11/01 12:00:54 mpi Exp $ */
+/* $OpenBSD: ohci.c,v 1.116 2013/11/09 08:46:05 mpi Exp $ */
/* $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
@@ -73,8 +73,6 @@ int ohcidebug = 0;
#define DPRINTFN(n,x)
#endif
-#define mstohz(ms) ((ms) * hz / 1000)
-
/*
* The OHCI controller is little endian, so on big endian machines
* the data stored in memory needs to be swapped.
@@ -1704,7 +1702,7 @@ ohci_device_request(struct usbd_xfer *xfer)
if (xfer->timeout && !sc->sc_bus.use_polling) {
timeout_del(&xfer->timeout_handle);
timeout_set(&xfer->timeout_handle, ohci_timeout, xfer);
- timeout_add(&xfer->timeout_handle, mstohz(xfer->timeout));
+ timeout_add_msec(&xfer->timeout_handle, xfer->timeout);
}
splx(s);
@@ -2879,7 +2877,7 @@ ohci_device_bulk_start(struct usbd_xfer *xfer)
if (xfer->timeout && !sc->sc_bus.use_polling) {
timeout_del(&xfer->timeout_handle);
timeout_set(&xfer->timeout_handle, ohci_timeout, xfer);
- timeout_add(&xfer->timeout_handle, mstohz(xfer->timeout));
+ timeout_add_msec(&xfer->timeout_handle, xfer->timeout);
}
#if 0
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 98352f3da36..90b67e299d4 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhci.c,v 1.103 2013/11/07 20:37:33 mpi Exp $ */
+/* $OpenBSD: uhci.c,v 1.104 2013/11/09 08:46:05 mpi Exp $ */
/* $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
@@ -81,8 +81,6 @@ int uhcinoloop = 0;
#define DPRINTFN(n,x)
#endif
-#define mstohz(ms) ((ms) * hz / 1000)
-
/*
* The UHCI controller is little endian, so on big endian machines
* the data stored in memory needs to be swapped.
@@ -569,7 +567,7 @@ uhci_activate(struct device *self, int act)
timeout_del(&sc->sc_poll_handle);
timeout_set(&sc->sc_poll_handle, uhci_poll_hub,
sc->sc_intr_xfer);
- timeout_add(&sc->sc_poll_handle, sc->sc_ival);
+ timeout_add_msec(&sc->sc_poll_handle, sc->sc_ival);
}
#ifdef UHCI_DEBUG
if (uhcidebug > 2)
@@ -867,7 +865,7 @@ uhci_poll_hub(void *addr)
timeout_del(&sc->sc_poll_handle);
timeout_set(&sc->sc_poll_handle, uhci_poll_hub, xfer);
- timeout_add(&sc->sc_poll_handle, sc->sc_ival);
+ timeout_add_msec(&sc->sc_poll_handle, sc->sc_ival);
p = KERNADDR(&xfer->dmabuf, 0);
p[0] = 0;
@@ -3417,10 +3415,10 @@ uhci_root_intr_start(struct usbd_xfer *xfer)
if (sc->sc_bus.dying)
return (USBD_IOERROR);
- sc->sc_ival = mstohz(xfer->pipe->endpoint->edesc->bInterval);
+ sc->sc_ival = xfer->pipe->endpoint->edesc->bInterval;
timeout_del(&sc->sc_poll_handle);
timeout_set(&sc->sc_poll_handle, uhci_poll_hub, xfer);
- timeout_add(&sc->sc_poll_handle, sc->sc_ival);
+ timeout_add_msec(&sc->sc_poll_handle, sc->sc_ival);
sc->sc_intr_xfer = xfer;
return (USBD_IN_PROGRESS);
}