From 881b65ce01b51c92e67365ad06ebf9bc3a1e46c1 Mon Sep 17 00:00:00 2001 From: tsutsui Date: Sat, 22 Feb 2003 05:24:16 +0000 Subject: [PATCH] Use mstohz() in rather than homegrown MS_TO_TICKS(). --- sys/dev/usb/ehci.c | 10 ++++------ sys/dev/usb/ohci.c | 8 ++++---- sys/dev/usb/ohcivar.h | 4 +--- sys/dev/usb/uhci.c | 12 +++++------- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c index ee8b731a6e2b..1451abebcedb 100644 --- a/sys/dev/usb/ehci.c +++ b/sys/dev/usb/ehci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ehci.c,v 1.44 2003/02/16 23:15:27 augustss Exp $ */ +/* $NetBSD: ehci.c,v 1.45 2003/02/22 05:24:16 tsutsui Exp $ */ /* * TODO @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.44 2003/02/16 23:15:27 augustss Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.45 2003/02/22 05:24:16 tsutsui Exp $"); #include #include @@ -212,8 +212,6 @@ Static void ehci_dump_exfer(struct ehci_xfer *); #endif #endif -#define MS_TO_TICKS(ms) ((ms) * hz / 1000) - #define EHCI_NULL htole32(EHCI_LINK_TERMINATE) #define EHCI_INTR_ENDPT 1 @@ -2569,7 +2567,7 @@ ehci_device_request(usbd_xfer_handle xfer) s = splusb(); ehci_set_qh_qtd(sqh, setup); if (xfer->timeout && !sc->sc_bus.use_polling) { - usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout), + usb_callout(xfer->timeout_handle, mstohz(xfer->timeout), ehci_timeout, xfer); } ehci_add_intr_list(sc, exfer); @@ -2679,7 +2677,7 @@ ehci_device_bulk_start(usbd_xfer_handle xfer) s = splusb(); ehci_set_qh_qtd(sqh, data); if (xfer->timeout && !sc->sc_bus.use_polling) { - usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout), + usb_callout(xfer->timeout_handle, mstohz(xfer->timeout), ehci_timeout, xfer); } ehci_add_intr_list(sc, exfer); diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index 1e8198979e44..1fc7a490fc13 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.138 2003/02/08 03:32:50 ichiro 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 $ */ /* @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.138 2003/02/08 03:32:50 ichiro Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $"); #include #include @@ -1728,7 +1728,7 @@ ohci_device_request(usbd_xfer_handle xfer) opipe->tail.td = tail; OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF); if (xfer->timeout && !sc->sc_bus.use_polling) { - usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout), + usb_callout(xfer->timeout_handle, mstohz(xfer->timeout), ohci_timeout, xfer); } splx(s); @@ -2897,7 +2897,7 @@ ohci_device_bulk_start(usbd_xfer_handle xfer) sed->ed.ed_flags &= htole32(~OHCI_ED_SKIP); OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_BLF); if (xfer->timeout && !sc->sc_bus.use_polling) { - usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout), + usb_callout(xfer->timeout_handle, mstohz(xfer->timeout), ohci_timeout, xfer); } diff --git a/sys/dev/usb/ohcivar.h b/sys/dev/usb/ohcivar.h index f0ca473ae07e..5094f23370c7 100644 --- a/sys/dev/usb/ohcivar.h +++ b/sys/dev/usb/ohcivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ohcivar.h,v 1.31 2002/09/30 16:36:20 augustss Exp $ */ +/* $NetBSD: ohcivar.h,v 1.32 2003/02/22 05:24:17 tsutsui Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohcivar.h,v 1.13 1999/11/17 22:33:41 n_hibma Exp $ */ /* @@ -154,5 +154,3 @@ int ohci_intr(void *); int ohci_detach(ohci_softc_t *, int); int ohci_activate(device_ptr_t, enum devact); #endif - -#define MS_TO_TICKS(ms) ((ms) * hz / 1000) diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index 90d658462eb0..2593e4d8a7ac 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $NetBSD: uhci.c,v 1.170 2003/02/19 01:35:04 augustss Exp $ */ +/* $NetBSD: uhci.c,v 1.171 2003/02/22 05:24:17 tsutsui Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ /* @@ -49,7 +49,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.170 2003/02/19 01:35:04 augustss Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.171 2003/02/22 05:24:17 tsutsui Exp $"); #include #include @@ -90,8 +90,6 @@ __KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.170 2003/02/19 01:35:04 augustss Exp $"); #define delay(d) DELAY(d) #endif -#define MS_TO_TICKS(ms) ((ms) * hz / 1000) - #if defined(__OpenBSD__) struct cfdriver uhci_cd = { NULL, "uhci", DV_DULL @@ -1864,7 +1862,7 @@ uhci_device_bulk_start(usbd_xfer_handle xfer) uhci_add_intr_info(sc, ii); if (xfer->timeout && !sc->sc_bus.use_polling) { - usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout), + usb_callout(xfer->timeout_handle, mstohz(xfer->timeout), uhci_timeout, ii); } xfer->status = USBD_IN_PROGRESS; @@ -2280,7 +2278,7 @@ uhci_device_request(usbd_xfer_handle xfer) } #endif if (xfer->timeout && !sc->sc_bus.use_polling) { - usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout), + usb_callout(xfer->timeout_handle, mstohz(xfer->timeout), uhci_timeout, ii); } xfer->status = USBD_IN_PROGRESS; @@ -3482,7 +3480,7 @@ uhci_root_intr_start(usbd_xfer_handle xfer) if (sc->sc_dying) return (USBD_IOERROR); - sc->sc_ival = MS_TO_TICKS(xfer->pipe->endpoint->edesc->bInterval); + sc->sc_ival = mstohz(xfer->pipe->endpoint->edesc->bInterval); usb_callout(sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub, xfer); sc->sc_intr_xfer = xfer; return (USBD_IN_PROGRESS);