summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMarc Balmer <mbalmer@cvs.openbsd.org>2007-06-10 10:15:36 +0000
committerMarc Balmer <mbalmer@cvs.openbsd.org>2007-06-10 10:15:36 +0000
commitba9346211f99b37c96aa619b9981b230c7b4a61d (patch)
treeccdeec5702822686e8702f14d705203c1db83ac3 /sys
parente306807c0defd347a543fa24bbd4d248729fe129 (diff)
Remove definitions and usage of usb_callout and related macros. These macros
were used as a layer of confusion^Wabstraction around the timeout(9) API. No binary change. ok jsg.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/arm/xscale/pxa27x_udc.c4
-rw-r--r--sys/dev/usb/ehci.c52
-rw-r--r--sys/dev/usb/ehcivar.h6
-rw-r--r--sys/dev/usb/if_aue.c16
-rw-r--r--sys/dev/usb/if_auereg.h4
-rw-r--r--sys/dev/usb/if_axe.c16
-rw-r--r--sys/dev/usb/if_axereg.h4
-rw-r--r--sys/dev/usb/if_cue.c12
-rw-r--r--sys/dev/usb/if_cuereg.h4
-rw-r--r--sys/dev/usb/if_udav.c16
-rw-r--r--sys/dev/usb/if_udavreg.h4
-rw-r--r--sys/dev/usb/if_upl.c4
-rw-r--r--sys/dev/usb/if_url.c16
-rw-r--r--sys/dev/usb/if_urlreg.h4
-rw-r--r--sys/dev/usb/if_wi_usb.c4
-rw-r--r--sys/dev/usb/ohci.c26
-rw-r--r--sys/dev/usb/ohcivar.h4
-rw-r--r--sys/dev/usb/uhci.c44
-rw-r--r--sys/dev/usb/uhcivar.h4
-rw-r--r--sys/dev/usb/ukbd.c33
-rw-r--r--sys/dev/usb/usb.c14
-rw-r--r--sys/dev/usb/usb_port.h13
-rw-r--r--sys/dev/usb/usbdi.c4
-rw-r--r--sys/dev/usb/usbdivar.h6
-rw-r--r--sys/dev/usb/usbf_subr.c14
-rw-r--r--sys/dev/usb/usbfvar.h6
26 files changed, 187 insertions, 147 deletions
diff --git a/sys/arch/arm/xscale/pxa27x_udc.c b/sys/arch/arm/xscale/pxa27x_udc.c
index 9fa8085174c..4e5258b991d 100644
--- a/sys/arch/arm/xscale/pxa27x_udc.c
+++ b/sys/arch/arm/xscale/pxa27x_udc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa27x_udc.c,v 1.19 2007/02/25 01:49:27 drahn Exp $ */
+/* $OpenBSD: pxa27x_udc.c,v 1.20 2007/06/10 10:15:35 mbalmer Exp $ */
/*
* Copyright (c) 2007 Dale Rahn <drahn@openbsd.org>
@@ -1159,7 +1159,7 @@ pxaudc_ctrl_abort(usbf_xfer_handle xfer)
*/
s = splusb();
xfer->status = USBF_CANCELLED;
- usb_uncallout(xfer->timeout_handle, pxaudc_timeout, NULL);
+ timeout_del(&xfer->timeout_handle);
splx(s);
/*
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c
index 5b1c325871d..8e140107960 100644
--- a/sys/dev/usb/ehci.c
+++ b/sys/dev/usb/ehci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ehci.c,v 1.71 2007/06/05 08:43:55 mbalmer Exp $ */
+/* $OpenBSD: ehci.c,v 1.72 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */
/*
@@ -469,8 +469,8 @@ ehci_init(ehci_softc_t *sc)
sc->sc_async_head = sqh;
EOWRITE4(sc, EHCI_ASYNCLISTADDR, sqh->physaddr | EHCI_LINK_QH);
- usb_callout_init(sc->sc_tmo_pcd);
- usb_callout_init(sc->sc_tmo_intrlist);
+ timeout_set(&sc->sc_tmo_pcd, NULL, NULL);
+ timeout_set(&sc->sc_tmo_intrlist, NULL, NULL);
rw_init(&sc->sc_doorbell_lock, "ehcidb");
@@ -584,7 +584,9 @@ ehci_intr1(ehci_softc_t *sc)
*/
ehci_pcd_able(sc, 0);
/* Do not allow RHSC interrupts > 1 per second */
- usb_callout(sc->sc_tmo_pcd, hz, ehci_pcd_enable, sc);
+ timeout_del(&sc->sc_tmo_pcd);
+ timeout_set(&sc->sc_tmo_pcd, ehci_pcd_enable, sc);
+ timeout_add(&sc->sc_tmo_pcd, hz);
eintrs &= ~EHCI_STS_PCD;
}
@@ -673,9 +675,11 @@ ehci_softintr(void *v)
/* Schedule a callout to catch any dropped transactions. */
if ((sc->sc_flags & EHCIF_DROPPED_INTR_WORKAROUND) &&
- !LIST_EMPTY(&sc->sc_intrhead))
- usb_callout(sc->sc_tmo_intrlist, hz,
- ehci_intrlist_timeout, sc);
+ !LIST_EMPTY(&sc->sc_intrhead)) {
+ timeout_del(&sc->sc_tmo_intrlist);
+ timeout_set(&sc->sc_tmo_intrlist, ehci_intrlist_timeout, sc);
+ timeout_add(&sc->sc_tmo_intrlist, hz);
+ }
#ifdef USB_USE_SOFTINTR
if (sc->sc_softwake) {
@@ -732,7 +736,7 @@ ehci_check_intr(ehci_softc_t *sc, struct ehci_xfer *ex)
}
done:
DPRINTFN(12, ("ehci_check_intr: ex=%p done\n", ex));
- usb_uncallout(ex->xfer.timeout_handle, ehci_timeout, ex);
+ timeout_del(&ex->xfer.timeout_handle);
usb_rem_task(ex->xfer.pipe->device, &ex->abort_task);
ehci_idone(ex);
}
@@ -897,8 +901,8 @@ ehci_detach(struct ehci_softc *sc, int flags)
if (rv != 0)
return (rv);
- usb_uncallout(sc->sc_tmo_intrlist, ehci_intrlist_timeout, sc);
- usb_uncallout(sc->sc_tmo_pcd, ehci_pcd_enable, sc);
+ timeout_del(&sc->sc_tmo_intrlist);
+ timeout_del(&sc->sc_tmo_pcd);
if (sc->sc_powerhook != NULL)
powerhook_disestablish(sc->sc_powerhook);
@@ -2424,7 +2428,7 @@ ehci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
/* If we're dying, just do the software part. */
s = splusb();
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, ehci_timeout, xfer);
+ timeout_del(&xfer->timeout_handle);
usb_rem_task(epipe->pipe.device, &exfer->abort_task);
usb_transfer_complete(xfer);
splx(s);
@@ -2458,7 +2462,7 @@ ehci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
s = splusb();
exfer->ehci_xfer_flags |= EHCI_XFER_ABORTING;
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, ehci_timeout, xfer);
+ timeout_del(&xfer->timeout_handle);
usb_rem_task(epipe->pipe.device, &exfer->abort_task);
splx(s);
@@ -2859,8 +2863,9 @@ 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, mstohz(xfer->timeout),
- ehci_timeout, xfer);
+ timeout_del(&xfer->timeout_handle);
+ timeout_set(&xfer->timeout_handle, ehci_timeout, xfer);
+ timeout_add(&xfer->timeout_handle, mstohz(xfer->timeout));
}
ehci_add_intr_list(sc, exfer);
xfer->status = USBD_IN_PROGRESS;
@@ -2969,8 +2974,9 @@ 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, mstohz(xfer->timeout),
- ehci_timeout, xfer);
+ timeout_del(&xfer->timeout_handle);
+ timeout_set(&xfer->timeout_handle, ehci_timeout, xfer);
+ timeout_add(&xfer->timeout_handle, mstohz(xfer->timeout));
}
ehci_add_intr_list(sc, exfer);
xfer->status = USBD_IN_PROGRESS;
@@ -3141,9 +3147,11 @@ ehci_device_intr_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, mstohz(xfer->timeout),
- ehci_timeout, xfer);
+ if (xfer->timeout && !sc->sc_bus.use_polling) {
+ timeout_del(&xfer->timeout_handle);
+ timeout_set(&xfer->timeout_handle, ehci_timeout, xfer);
+ timeout_add(&xfer->timeout_handle, mstohz(xfer->timeout));
+ }
ehci_add_intr_list(sc, exfer);
xfer->status = USBD_IN_PROGRESS;
splx(s);
@@ -3235,8 +3243,10 @@ ehci_device_intr_done(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,
- mstohz(xfer->timeout), ehci_timeout, xfer);
+ timeout_del(&xfer->timeout_handle);
+ timeout_set(&xfer->timeout_handle, ehci_timeout, xfer);
+ timeout_add(&xfer->timeout_handle,
+ mstohz(xfer->timeout));
}
splx(s);
diff --git a/sys/dev/usb/ehcivar.h b/sys/dev/usb/ehcivar.h
index df68eaa40a9..4e34781c769 100644
--- a/sys/dev/usb/ehcivar.h
+++ b/sys/dev/usb/ehcivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ehcivar.h,v 1.11 2007/05/20 00:52:26 jsg Exp $ */
+/* $OpenBSD: ehcivar.h,v 1.12 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: ehcivar.h,v 1.19 2005/04/29 15:04:29 augustss Exp $ */
/*
@@ -133,8 +133,8 @@ typedef struct ehci_softc {
struct rwlock sc_doorbell_lock;
- usb_callout_t sc_tmo_pcd;
- usb_callout_t sc_tmo_intrlist;
+ struct timeout sc_tmo_pcd;
+ struct timeout sc_tmo_intrlist;
device_ptr_t sc_child; /* /dev/usb# device */
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index 8fe06977cea..bec33195957 100644
--- a/sys/dev/usb/if_aue.c
+++ b/sys/dev/usb/if_aue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_aue.c,v 1.58 2007/06/09 12:22:53 mbalmer Exp $ */
+/* $OpenBSD: if_aue.c,v 1.59 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: if_aue.c,v 1.82 2003/03/05 17:37:36 shiba Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -820,7 +820,7 @@ aue_attach(struct device *parent, struct device *self, void *aux)
if_attach(ifp);
ether_ifattach(ifp);
- usb_callout_init(sc->aue_stat_ch);
+ timeout_set(&sc->aue_stat_ch, NULL, NULL);
sc->aue_attached = 1;
sc->sc_sdhook = shutdownhook_establish(aue_shutdown, sc);
@@ -844,7 +844,7 @@ aue_detach(struct device *self, int flags)
return (0);
}
- usb_uncallout(sc->aue_stat_ch, aue_tick, sc);
+ timeout_del(&sc->aue_stat_ch);
/*
* Remove any pending tasks. They cannot be executing because they run
* in the same thread as detach.
@@ -1235,7 +1235,9 @@ aue_tick_task(void *xsc)
aue_start(ifp);
}
- usb_callout(sc->aue_stat_ch, hz, aue_tick, sc);
+ timeout_del(&sc->aue_stat_ch);
+ timeout_set(&sc->aue_stat_ch, aue_tick, sc);
+ timeout_add(&sc->aue_stat_ch, hz);
splx(s);
}
@@ -1405,7 +1407,9 @@ aue_init(void *xsc)
splx(s);
- usb_callout(sc->aue_stat_ch, hz, aue_tick, sc);
+ timeout_del(&sc->aue_stat_ch);
+ timeout_set(&sc->aue_stat_ch, aue_tick, sc);
+ timeout_add(&sc->aue_stat_ch, hz);
}
int
@@ -1634,7 +1638,7 @@ aue_stop(struct aue_softc *sc)
aue_csr_write_1(sc, AUE_CTL0, 0);
aue_csr_write_1(sc, AUE_CTL1, 0);
aue_reset(sc);
- usb_uncallout(sc->aue_stat_ch, aue_tick, sc);
+ timeout_del(&sc->aue_stat_ch);
/* Stop transfers. */
if (sc->aue_ep[AUE_ENDPT_RX] != NULL) {
diff --git a/sys/dev/usb/if_auereg.h b/sys/dev/usb/if_auereg.h
index 7eacc02cb9a..764dca794dc 100644
--- a/sys/dev/usb/if_auereg.h
+++ b/sys/dev/usb/if_auereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_auereg.h,v 1.12 2007/06/06 19:25:49 mk Exp $ */
+/* $OpenBSD: if_auereg.h,v 1.13 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: if_auereg.h,v 1.16 2001/10/10 02:14:17 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -232,7 +232,7 @@ struct aue_softc {
#define GET_IFP(sc) (&(sc)->arpcom.ac_if)
#define GET_MII(sc) (&(sc)->aue_mii)
- usb_callout_t aue_stat_ch;
+ struct timeout aue_stat_ch;
usbd_device_handle aue_udev;
usbd_interface_handle aue_iface;
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c
index 8a877c9b2bd..a6b3b51be71 100644
--- a/sys/dev/usb/if_axe.c
+++ b/sys/dev/usb/if_axe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_axe.c,v 1.71 2007/06/09 12:22:53 mbalmer Exp $ */
+/* $OpenBSD: if_axe.c,v 1.72 2007/06/10 10:15:35 mbalmer Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Jonathan Gray <jsg@openbsd.org>
@@ -714,7 +714,7 @@ axe_attach(struct device *parent, struct device *self, void *aux)
if_attach(ifp);
ether_ifattach(ifp);
- usb_callout_init(sc->axe_stat_ch);
+ timeout_set(&sc->axe_stat_ch, NULL, NULL);
sc->axe_attached = 1;
splx(s);
@@ -736,7 +736,7 @@ axe_detach(struct device *self, int flags)
if (!sc->axe_attached)
return (0);
- usb_uncallout(sc->axe_stat_ch, axe_tick, sc);
+ timeout_del(&sc->axe_stat_ch);
sc->axe_dying = 1;
@@ -1111,7 +1111,9 @@ axe_tick_task(void *xsc)
axe_start(ifp);
}
- usb_callout(sc->axe_stat_ch, hz, axe_tick, sc);
+ timeout_del(&sc->axe_stat_ch);
+ timeout_set(&sc->axe_stat_ch, axe_tick, sc);
+ timeout_add(&sc->axe_stat_ch, hz);
splx(s);
}
@@ -1310,7 +1312,9 @@ axe_init(void *xsc)
splx(s);
- usb_callout(sc->axe_stat_ch, hz, axe_tick, sc);
+ timeout_del(&sc->axe_stat_ch);
+ timeout_set(&sc->axe_stat_ch, axe_tick, sc);
+ timeout_add(&sc->axe_stat_ch, hz);
return;
}
@@ -1438,7 +1442,7 @@ axe_stop(struct axe_softc *sc)
ifp->if_timer = 0;
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
- usb_uncallout(sc->axe_stat_ch, axe_tick, sc);
+ timeout_del(&sc->axe_stat_ch);
/* Stop transfers. */
if (sc->axe_ep[AXE_ENDPT_RX] != NULL) {
diff --git a/sys/dev/usb/if_axereg.h b/sys/dev/usb/if_axereg.h
index 5fdd26223e5..5daf157e9e2 100644
--- a/sys/dev/usb/if_axereg.h
+++ b/sys/dev/usb/if_axereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_axereg.h,v 1.17 2007/06/06 19:25:49 mk Exp $ */
+/* $OpenBSD: if_axereg.h,v 1.18 2007/06/10 10:15:35 mbalmer Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003
@@ -208,7 +208,7 @@ struct axe_softc {
int axe_unit;
int axe_if_flags;
struct axe_cdata axe_cdata;
- usb_callout_t axe_stat_ch;
+ struct timeout axe_stat_ch;
int axe_refcnt;
char axe_dying;
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index 3203c858d2d..56ec079787c 100644
--- a/sys/dev/usb/if_cue.c
+++ b/sys/dev/usb/if_cue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cue.c,v 1.38 2007/06/09 12:22:53 mbalmer Exp $ */
+/* $OpenBSD: if_cue.c,v 1.39 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: if_cue.c,v 1.40 2002/07/11 21:14:26 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -528,7 +528,7 @@ cue_attach(struct device *parent, struct device *self, void *aux)
if_attach(ifp);
ether_ifattach(ifp);
- usb_callout_init(sc->cue_stat_ch);
+ timeout_set(&sc->cue_stat_ch, NULL, NULL);
sc->cue_attached = 1;
splx(s);
@@ -546,7 +546,7 @@ cue_detach(struct device *self, int flags)
DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->cue_dev), __func__));
- usb_uncallout(sc->cue_stat_ch, cue_tick, sc);
+ timeout_del(&sc->cue_stat_ch);
/*
* Remove any pending task. It cannot be executing because it run
* in the same thread as detach.
@@ -1047,7 +1047,9 @@ cue_init(void *xsc)
splx(s);
- usb_callout(sc->cue_stat_ch, hz, cue_tick, sc);
+ timeout_del(&sc->cue_stat_ch);
+ timeout_set(&sc->cue_stat_ch, cue_tick, sc);
+ timeout_add(&sc->cue_stat_ch, hz);
}
int
@@ -1212,7 +1214,7 @@ cue_stop(struct cue_softc *sc)
cue_csr_write_1(sc, CUE_ETHCTL, 0);
cue_reset(sc);
- usb_uncallout(sc->cue_stat_ch, cue_tick, sc);
+ timeout_del(&sc->cue_stat_ch);
/* Stop transfers. */
if (sc->cue_ep[CUE_ENDPT_RX] != NULL) {
diff --git a/sys/dev/usb/if_cuereg.h b/sys/dev/usb/if_cuereg.h
index 2ea678abf10..7c344676ede 100644
--- a/sys/dev/usb/if_cuereg.h
+++ b/sys/dev/usb/if_cuereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cuereg.h,v 1.9 2007/06/06 19:25:49 mk Exp $ */
+/* $OpenBSD: if_cuereg.h,v 1.10 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: if_cuereg.h,v 1.14 2001/01/21 22:09:24 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -170,7 +170,7 @@ struct cue_softc {
struct arpcom arpcom;
#define GET_IFP(sc) (&(sc)->arpcom.ac_if)
- usb_callout_t cue_stat_ch;
+ struct timeout cue_stat_ch;
usbd_device_handle cue_udev;
usbd_interface_handle cue_iface;
diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c
index 038bc3f20a0..574bbd91907 100644
--- a/sys/dev/usb/if_udav.c
+++ b/sys/dev/usb/if_udav.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_udav.c,v 1.27 2007/06/09 12:22:53 mbalmer Exp $ */
+/* $OpenBSD: if_udav.c,v 1.28 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: if_udav.c,v 1.3 2004/04/23 17:25:25 itojun Exp $ */
/* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */
/*
@@ -291,7 +291,7 @@ udav_attach(struct device *parent, struct device *self, void *aux)
if_attach(ifp);
ether_ifattach(ifp);
- usb_callout_init(sc->sc_stat_ch);
+ timeout_set(&sc->sc_stat_ch, NULL, NULL);
sc->sc_attached = 1;
splx(s);
@@ -317,7 +317,7 @@ udav_detach(struct device *self, int flags)
if (!sc->sc_attached)
return (0);
- usb_uncallout(sc->sc_stat_ch, udav_tick, sc);
+ timeout_del(&sc->sc_stat_ch);
/* Remove any pending tasks */
usb_rem_task(sc->sc_udev, &sc->sc_tick_task);
@@ -669,7 +669,9 @@ udav_init(struct ifnet *ifp)
splx(s);
- usb_callout(sc->sc_stat_ch, hz, udav_tick, sc);
+ timeout_del(&sc->sc_stat_ch);
+ timeout_set(&sc->sc_stat_ch, udav_tick, sc);
+ timeout_add(&sc->sc_stat_ch, hz);
return (0);
}
@@ -1312,7 +1314,7 @@ udav_stop(struct ifnet *ifp, int disable)
udav_reset(sc);
- usb_uncallout(sc->sc_stat_ch, udav_tick, sc);
+ timeout_del(&sc->sc_stat_ch);
/* Stop transfers */
/* RX endpoint */
@@ -1483,7 +1485,9 @@ udav_tick_task(void *xsc)
udav_start(ifp);
}
- usb_callout(sc->sc_stat_ch, hz, udav_tick, sc);
+ timeout_del(&sc->sc_stat_ch);
+ timeout_set(&sc->sc_stat_ch, udav_tick, sc);
+ timeout_add(&sc->sc_stat_ch, hz);
splx(s);
}
diff --git a/sys/dev/usb/if_udavreg.h b/sys/dev/usb/if_udavreg.h
index 78175afb75b..8d428d6d15e 100644
--- a/sys/dev/usb/if_udavreg.h
+++ b/sys/dev/usb/if_udavreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_udavreg.h,v 1.8 2007/06/09 11:06:53 mbalmer Exp $ */
+/* $OpenBSD: if_udavreg.h,v 1.9 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: if_udavreg.h,v 1.2 2003/09/04 15:17:39 tsutsui Exp $ */
/* $nabe: if_udavreg.h,v 1.2 2003/08/21 16:26:40 nabe Exp $ */
/*
@@ -172,7 +172,7 @@ struct udav_softc {
usbd_pipe_handle sc_pipe_rx;
usbd_pipe_handle sc_pipe_tx;
usbd_pipe_handle sc_pipe_intr;
- usb_callout_t sc_stat_ch;
+ struct timeout sc_stat_ch;
u_int sc_rx_errs;
/* u_int sc_intr_errs; */
struct timeval sc_rx_notice;
diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c
index 99f1803156f..8eb72e2bee7 100644
--- a/sys/dev/usb/if_upl.c
+++ b/sys/dev/usb/if_upl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_upl.c,v 1.32 2007/06/09 12:22:53 mbalmer Exp $ */
+/* $OpenBSD: if_upl.c,v 1.33 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: if_upl.c,v 1.19 2002/07/11 21:14:26 augustss Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -140,7 +140,7 @@ struct upl_softc {
struct device sc_dev;
struct ifnet sc_if;
- usb_callout_t sc_stat_ch;
+ struct timeout sc_stat_ch;
usbd_device_handle sc_udev;
usbd_interface_handle sc_iface;
diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c
index f3120d84b81..e8a6a58c5b5 100644
--- a/sys/dev/usb/if_url.c
+++ b/sys/dev/usb/if_url.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_url.c,v 1.41 2007/06/09 12:22:53 mbalmer Exp $ */
+/* $OpenBSD: if_url.c,v 1.42 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: if_url.c,v 1.6 2002/09/29 10:19:21 martin Exp $ */
/*
* Copyright (c) 2001, 2002
@@ -300,7 +300,7 @@ url_attach(struct device *parent, struct device *self, void *aux)
if_attach(ifp);
ether_ifattach(ifp);
- usb_callout_init(sc->sc_stat_ch);
+ timeout_set(&sc->sc_stat_ch, NULL, NULL);
sc->sc_attached = 1;
splx(s);
@@ -326,7 +326,7 @@ url_detach(struct device *self, int flags)
if (!sc->sc_attached)
return (0);
- usb_uncallout(sc->sc_stat_ch, url_tick, sc);
+ timeout_del(&sc->sc_stat_ch);
/* Remove any pending tasks */
usb_rem_task(sc->sc_udev, &sc->sc_tick_task);
@@ -564,7 +564,9 @@ url_init(struct ifnet *ifp)
splx(s);
- usb_callout(sc->sc_stat_ch, hz, url_tick, sc);
+ timeout_del(&sc->sc_stat_ch);
+ timeout_set(&sc->sc_stat_ch, url_tick, sc);
+ timeout_add(&sc->sc_stat_ch, hz);
return (0);
}
@@ -1200,7 +1202,7 @@ url_stop(struct ifnet *ifp, int disable)
url_reset(sc);
- usb_uncallout(sc->sc_stat_ch, url_tick, sc);
+ timeout_del(&sc->sc_stat_ch);
/* Stop transfers */
/* RX endpoint */
@@ -1371,7 +1373,9 @@ url_tick_task(void *xsc)
url_start(ifp);
}
- usb_callout(sc->sc_stat_ch, hz, url_tick, sc);
+ timeout_del(&sc->sc_stat_ch);
+ timeout_set(&sc->sc_stat_ch, url_tick, sc);
+ timeout_add(&sc->sc_stat_ch, hz);
splx(s);
}
diff --git a/sys/dev/usb/if_urlreg.h b/sys/dev/usb/if_urlreg.h
index 7d4f1e7e959..214900ab015 100644
--- a/sys/dev/usb/if_urlreg.h
+++ b/sys/dev/usb/if_urlreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_urlreg.h,v 1.10 2007/06/06 19:25:49 mk Exp $ */
+/* $OpenBSD: if_urlreg.h,v 1.11 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: if_urlreg.h,v 1.1 2002/03/28 21:09:11 ichiro Exp $ */
/*
* Copyright (c) 2001, 2002
@@ -162,7 +162,7 @@ struct url_softc {
usbd_pipe_handle sc_pipe_rx;
usbd_pipe_handle sc_pipe_tx;
usbd_pipe_handle sc_pipe_intr;
- usb_callout_t sc_stat_ch;
+ struct timeout sc_stat_ch;
u_int sc_rx_errs;
/* u_int sc_intr_errs; */
struct timeval sc_rx_notice;
diff --git a/sys/dev/usb/if_wi_usb.c b/sys/dev/usb/if_wi_usb.c
index 813e6e1f352..ccfbcd3558a 100644
--- a/sys/dev/usb/if_wi_usb.c
+++ b/sys/dev/usb/if_wi_usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi_usb.c,v 1.37 2007/06/09 12:22:53 mbalmer Exp $ */
+/* $OpenBSD: if_wi_usb.c,v 1.38 2007/06/10 10:15:35 mbalmer Exp $ */
/*
* Copyright (c) 2003 Dale Rahn. All rights reserved.
@@ -137,7 +137,7 @@ struct wi_usb_softc {
struct wi_softc sc_wi;
#define wi_usb_dev sc_wi.sc_dev
- usb_callout_t wi_usb_stat_ch;
+ struct timeout wi_usb_stat_ch;
usbd_device_handle wi_usb_udev;
usbd_interface_handle wi_usb_iface;
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index 23064422c6c..0ea46a6a2a3 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci.c,v 1.79 2007/06/05 08:43:55 mbalmer Exp $ */
+/* $OpenBSD: ohci.c,v 1.80 2007/06/10 10:15:35 mbalmer 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 $ */
@@ -340,7 +340,7 @@ ohci_detach(struct ohci_softc *sc, int flags)
if (rv != 0)
return (rv);
- usb_uncallout(sc->sc_tmo_rhsc, ohci_rhsc_enable, sc);
+ timeout_del(&sc->sc_tmo_rhsc);
if (sc->sc_shutdownhook != NULL)
shutdownhook_disestablish(sc->sc_shutdownhook);
@@ -863,7 +863,7 @@ ohci_init(ohci_softc_t *sc)
sc->sc_control = sc->sc_intre = 0;
sc->sc_shutdownhook = shutdownhook_establish(ohci_shutdown, sc);
- usb_callout_init(sc->sc_tmo_rhsc);
+ timeout_set(&sc->sc_tmo_rhsc, NULL, NULL);
/* Finally, turn on interrupts. */
DPRINTFN(1,("ohci_init: enabling\n"));
@@ -1186,7 +1186,9 @@ ohci_intr1(ohci_softc_t *sc)
USBDEVNAME(sc->sc_bus.bdev)));
/* Do not allow RHSC interrupts > 1 per second */
- usb_callout(sc->sc_tmo_rhsc, hz, ohci_rhsc_enable, sc);
+ timeout_del(&sc->sc_tmo_rhsc);
+ timeout_set(&sc->sc_tmo_rhsc, ohci_rhsc_enable, sc);
+ timeout_add(&sc->sc_tmo_rhsc, hz);
eintrs &= ~OHCI_RHSC;
}
@@ -1341,7 +1343,7 @@ ohci_softintr(void *v)
/* Handled by abort routine. */
continue;
}
- usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
+ timeout_del(&xfer->timeout_handle);
len = std->len;
if (std->td.td_cbp != 0)
@@ -1743,8 +1745,9 @@ 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, mstohz(xfer->timeout),
- ohci_timeout, xfer);
+ timeout_del(&xfer->timeout_handle);
+ timeout_set(&xfer->timeout_handle, ohci_timeout, xfer);
+ timeout_add(&xfer->timeout_handle, mstohz(xfer->timeout));
}
splx(s);
@@ -2189,7 +2192,7 @@ ohci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
/* If we're dying, just do the software part. */
s = splusb();
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
+ timeout_del(&xfer->timeout_handle);
usb_transfer_complete(xfer);
splx(s);
return;
@@ -2203,7 +2206,7 @@ ohci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
*/
s = splusb();
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
+ timeout_del(&xfer->timeout_handle);
splx(s);
DPRINTFN(1,("ohci_abort_xfer: stop ed=%p\n", sed));
sed->ed.ed_flags |= htole32(OHCI_ED_SKIP); /* force hardware skip */
@@ -2923,8 +2926,9 @@ 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, mstohz(xfer->timeout),
- ohci_timeout, xfer);
+ timeout_del(&xfer->timeout_handle);
+ timeout_set(&xfer->timeout_handle, ohci_timeout, xfer);
+ timeout_add(&xfer->timeout_handle, mstohz(xfer->timeout));
}
#if 0
diff --git a/sys/dev/usb/ohcivar.h b/sys/dev/usb/ohcivar.h
index fa9ce3e21c7..9f6930deb8d 100644
--- a/sys/dev/usb/ohcivar.h
+++ b/sys/dev/usb/ohcivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohcivar.h,v 1.22 2007/03/22 05:53:36 pascoe Exp $ */
+/* $OpenBSD: ohcivar.h,v 1.23 2007/06/10 10:15:35 mbalmer 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 $ */
@@ -135,7 +135,7 @@ typedef struct ohci_softc {
u_int sc_overrun_cnt;
struct timeval sc_overrun_ntc;
- usb_callout_t sc_tmo_rhsc;
+ struct timeout sc_tmo_rhsc;
device_ptr_t sc_child;
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 983d09d9e54..752920dcdcd 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhci.c,v 1.55 2007/06/05 08:43:55 mbalmer Exp $ */
+/* $OpenBSD: uhci.c,v 1.56 2007/06/10 10:15:35 mbalmer 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 $ */
@@ -488,7 +488,7 @@ uhci_init(uhci_softc_t *sc)
SIMPLEQ_INIT(&sc->sc_free_xfers);
- usb_callout_init(sc->sc_poll_handle);
+ timeout_set(&sc->sc_poll_handle, NULL, NULL);
/* Set up the bus struct. */
sc->sc_bus.methods = &uhci_bus_methods;
@@ -685,8 +685,7 @@ uhci_power(int why, void *v)
uhci_dumpregs(sc);
#endif
if (sc->sc_intr_xfer != NULL)
- usb_uncallout(sc->sc_poll_handle, uhci_poll_hub,
- sc->sc_intr_xfer);
+ timeout_del(&sc->sc_poll_handle);
sc->sc_bus.use_polling++;
uhci_run(sc, 0); /* stop the controller */
@@ -725,9 +724,12 @@ uhci_power(int why, void *v)
uhci_run(sc, 1); /* and start traffic again */
usb_delay_ms(&sc->sc_bus, USB_RESUME_RECOVERY);
sc->sc_bus.use_polling--;
- if (sc->sc_intr_xfer != NULL)
- usb_callout(sc->sc_poll_handle, sc->sc_ival,
- uhci_poll_hub, sc->sc_intr_xfer);
+ if (sc->sc_intr_xfer != NULL) {
+ 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);
+ }
#ifdef UHCI_DEBUG
if (uhcidebug > 2)
uhci_dumpregs(sc);
@@ -939,7 +941,9 @@ uhci_poll_hub(void *addr)
DPRINTFN(20, ("uhci_poll_hub\n"));
- usb_callout(sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub, xfer);
+ 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);
p = KERNADDR(&xfer->dmabuf, 0);
p[0] = 0;
@@ -1315,7 +1319,7 @@ uhci_check_intr(uhci_softc_t *sc, uhci_intr_info_t *ii)
}
done:
DPRINTFN(12, ("uhci_check_intr: ii=%p done\n", ii));
- usb_uncallout(ii->xfer->timeout_handle, uhci_timeout, ii);
+ timeout_del(&ii->xfer->timeout_handle);
uhci_idone(ii);
}
@@ -1840,8 +1844,9 @@ 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, mstohz(xfer->timeout),
- uhci_timeout, ii);
+ timeout_del(&xfer->timeout_handle);
+ timeout_set(&xfer->timeout_handle, uhci_timeout, ii);
+ timeout_add(&xfer->timeout_handle, mstohz(xfer->timeout));
}
xfer->status = USBD_IN_PROGRESS;
splx(s);
@@ -1892,7 +1897,7 @@ uhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
/* If we're dying, just do the software part. */
s = splusb();
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, uhci_timeout, xfer);
+ timeout_del(&xfer->timeout_handle);
usb_transfer_complete(xfer);
splx(s);
return;
@@ -1906,7 +1911,7 @@ uhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
*/
s = splusb();
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, uhci_timeout, ii);
+ timeout_del(&xfer->timeout_handle);
DPRINTFN(1,("uhci_abort_xfer: stop ii=%p\n", ii));
for (std = ii->stdstart; std != NULL; std = std->link.std)
std->td.td_status &= htole32(~(UHCI_TD_ACTIVE | UHCI_TD_IOC));
@@ -2264,8 +2269,9 @@ uhci_device_request(usbd_xfer_handle xfer)
}
#endif
if (xfer->timeout && !sc->sc_bus.use_polling) {
- usb_callout(xfer->timeout_handle, mstohz(xfer->timeout),
- uhci_timeout, ii);
+ timeout_del(&xfer->timeout_handle);
+ timeout_set(&xfer->timeout_handle, uhci_timeout, ii);
+ timeout_add(&xfer->timeout_handle, mstohz(xfer->timeout));
}
xfer->status = USBD_IN_PROGRESS;
splx(s);
@@ -3426,7 +3432,7 @@ uhci_root_intr_abort(usbd_xfer_handle xfer)
{
uhci_softc_t *sc = (uhci_softc_t *)xfer->pipe->device->bus;
- usb_uncallout(sc->sc_poll_handle, uhci_poll_hub, xfer);
+ timeout_del(&sc->sc_poll_handle);
sc->sc_intr_xfer = NULL;
if (xfer->pipe->intrxfer == xfer) {
@@ -3470,7 +3476,9 @@ uhci_root_intr_start(usbd_xfer_handle xfer)
return (USBD_IOERROR);
sc->sc_ival = mstohz(xfer->pipe->endpoint->edesc->bInterval);
- usb_callout(sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub, xfer);
+ 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);
sc->sc_intr_xfer = xfer;
return (USBD_IN_PROGRESS);
}
@@ -3481,7 +3489,7 @@ uhci_root_intr_close(usbd_pipe_handle pipe)
{
uhci_softc_t *sc = (uhci_softc_t *)pipe->device->bus;
- usb_uncallout(sc->sc_poll_handle, uhci_poll_hub, sc->sc_intr_xfer);
+ timeout_del(&sc->sc_poll_handle);
sc->sc_intr_xfer = NULL;
DPRINTF(("uhci_root_intr_close\n"));
}
diff --git a/sys/dev/usb/uhcivar.h b/sys/dev/usb/uhcivar.h
index be584fd4192..776b745b123 100644
--- a/sys/dev/usb/uhcivar.h
+++ b/sys/dev/usb/uhcivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhcivar.h,v 1.16 2007/06/04 10:34:04 mbalmer Exp $ */
+/* $OpenBSD: uhcivar.h,v 1.17 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: uhcivar.h,v 1.36 2002/12/31 00:39:11 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhcivar.h,v 1.14 1999/11/17 22:33:42 n_hibma Exp $ */
@@ -175,7 +175,7 @@ typedef struct uhci_softc {
/* Info for the root hub interrupt "pipe". */
int sc_ival; /* time between root hub intrs */
usbd_xfer_handle sc_intr_xfer; /* root hub interrupt transfer */
- usb_callout_t sc_poll_handle;
+ struct timeout sc_poll_handle;
char sc_vendor[32]; /* vendor string for root hub */
int sc_id_vendor; /* vendor ID for root hub */
diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c
index 660ca6f81ae..d6b55e01f6f 100644
--- a/sys/dev/usb/ukbd.c
+++ b/sys/dev/usb/ukbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ukbd.c,v 1.31 2007/06/05 08:43:55 mbalmer Exp $ */
+/* $OpenBSD: ukbd.c,v 1.32 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -234,7 +234,7 @@ struct ukbd_softc {
int sc_console_keyboard; /* we are the console keyboard */
char sc_debounce; /* for quirk handling */
- usb_callout_t sc_delay; /* for quirk handling */
+ struct timeout sc_delay; /* for quirk handling */
struct ukbd_data sc_data; /* for quirk handling */
struct hid_location sc_numloc;
@@ -242,7 +242,7 @@ struct ukbd_softc {
struct hid_location sc_scroloc;
int sc_leds;
- usb_callout_t sc_rawrepeat_ch;
+ struct timeout sc_rawrepeat_ch;
struct device *sc_wskbddev;
#if defined(WSDISPLAY_COMPAT_RAWKBD)
@@ -438,8 +438,8 @@ ukbd_attach(struct device *parent, struct device *self, void *aux)
a.accessops = &ukbd_accessops;
a.accesscookie = sc;
- usb_callout_init(sc->sc_rawrepeat_ch);
- usb_callout_init(sc->sc_delay);
+ timeout_set(&sc->sc_rawrepeat_ch, NULL, NULL);
+ timeout_set(&sc->sc_delay, NULL, NULL);
/* Flash the leds; no real purpose, just shows we're alive. */
ukbd_set_leds(sc, WSKBD_LED_SCROLL | WSKBD_LED_NUM | WSKBD_LED_CAPS);
@@ -568,7 +568,9 @@ ukbd_intr(struct uhidev *addr, void *ibuf, u_int len)
* We avoid this bug by holding off decoding for 20 ms.
*/
sc->sc_data = *ud;
- usb_callout(sc->sc_delay, hz / 50, ukbd_delayed_decode, sc);
+ timeout_del(&sc->sc_delay);
+ timeout_set(&sc->sc_delay, ukbd_delayed_decode, sc);
+ timeout_add(&sc->sc_delay, hz / 50);
#ifdef DDB
} else if (sc->sc_console_keyboard && !sc->sc_polling) {
/*
@@ -578,7 +580,9 @@ ukbd_intr(struct uhidev *addr, void *ibuf, u_int len)
* loses bigtime.
*/
sc->sc_data = *ud;
- usb_callout(sc->sc_delay, 1, ukbd_delayed_decode, sc);
+ timeout_del(&sc->sc_delay);
+ timeout_set(&sc->sc_delay, ukbd_delayed_decode, sc);
+ timeout_add(&sc->sc_delay, 1);
#endif
} else {
ukbd_decode(sc, ud);
@@ -711,11 +715,13 @@ ukbd_decode(struct ukbd_softc *sc, struct ukbd_data *ud)
s = spltty();
wskbd_rawinput(sc->sc_wskbddev, cbuf, j);
splx(s);
- usb_uncallout(sc->sc_rawrepeat_ch, ukbd_rawrepeat, sc);
+ timeout_del(&sc->sc_rawrepeat_ch);
if (npress != 0) {
sc->sc_nrep = npress;
- usb_callout(sc->sc_rawrepeat_ch,
- hz * REP_DELAY1 / 1000, ukbd_rawrepeat, sc);
+ timeout_del(&sc->sc_rawrepeat_ch);
+ timeout_set(&sc->sc_rawrepeat_ch, ukbd_rawrepeat, sc);
+ timeout_add(&sc->sc_rawrepeat_ch,
+ hz * REP_DELAY1 / 1000);
}
return;
}
@@ -767,8 +773,9 @@ ukbd_rawrepeat(void *v)
s = spltty();
wskbd_rawinput(sc->sc_wskbddev, sc->sc_rep, sc->sc_nrep);
splx(s);
- usb_callout(sc->sc_rawrepeat_ch, hz * REP_DELAYN / 1000,
- ukbd_rawrepeat, sc);
+ timeout_del(&sc->sc_rawrepeat_ch);
+ timeout_set(&sc->sc_rawrepeat_ch, ukbd_rawrepeat, sc);
+ timeout_add(&sc->sc_rawrepeat_ch, hz * REP_DELAYN / 1000);
}
#endif
@@ -791,7 +798,7 @@ ukbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
case WSKBDIO_SETMODE:
DPRINTF(("ukbd_ioctl: set raw = %d\n", *(int *)data));
sc->sc_rawkbd = *(int *)data == WSKBD_RAW;
- usb_uncallout(sc->sc_rawrepeat_ch, ukbd_rawrepeat, sc);
+ timeout_del(&sc->sc_rawrepeat_ch);
return (0);
#endif
}
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index 43bc1d378e0..759d8a67268 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usb.c,v 1.43 2007/06/06 19:25:49 mk Exp $ */
+/* $OpenBSD: usb.c,v 1.44 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */
/*
@@ -191,7 +191,7 @@ usb_attach(struct device *parent, struct device *self, void *aux)
return;
}
#else
- usb_callout_init(sc->sc_bus->softi);
+ timeout_set(&sc->sc_bus->softi, NULL, NULL);
#endif
#endif
@@ -766,9 +766,11 @@ usb_schedsoftintr(usbd_bus_handle bus)
#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
softintr_schedule(bus->soft);
#else
- if (!usb_callout_pending(bus->softi))
- usb_callout(bus->softi, 0, bus->methods->soft_intr,
- bus);
+ if (!timeout_pending(&bus->softi)) {
+ timeout_del(&bus->softi);
+ timeout_set(&bus->softi, bus->methods->soft_intr, bus);
+ timeout_add(&bus->softi, 0);
+ }
#endif /* __HAVE_GENERIC_SOFT_INTERRUPTS */
}
#else
@@ -831,7 +833,7 @@ usb_detach(device_ptr_t self, int flags)
sc->sc_bus->soft = NULL;
}
#else
- usb_uncallout(sc->sc_bus->softi, bus->methods->soft_intr, bus);
+ timeout_del(&sc->sc_bus->softi);
#endif
#endif
diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h
index 9e450fc3c14..0e830f536da 100644
--- a/sys/dev/usb/usb_port.h
+++ b/sys/dev/usb/usb_port.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: usb_port.h,v 1.74 2007/06/10 08:02:16 mbalmer Exp $ */
+/* $OpenBSD: usb_port.h,v 1.75 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: usb_port.h,v 1.62 2003/02/15 18:33:30 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.21 1999/11/17 22:33:47 n_hibma Exp $ */
@@ -98,17 +98,6 @@ typedef struct device *device_ptr_t;
u_int offs; \
} usb_dma_t
-typedef struct timeout usb_callout_t;
-#define usb_callout_init(h) timeout_set(&(h), NULL, NULL)
-#define usb_callout(h, t, f, d) \
- do { \
- timeout_del(&(h)); \
- timeout_set(&(h), (f), (d)); \
- timeout_add(&(h), (t)); \
- } while (0)
-#define usb_callout_pending(h) timeout_pending(&(h))
-#define usb_uncallout(h, f, d) timeout_del(&(h))
-
#define USB_DECLARE_DRIVER_CLASS(dname, devclass) \
int __CONCAT(dname,_match)(struct device *, void *, void *); \
void __CONCAT(dname,_attach)(struct device *, struct device *, void *); \
diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c
index 1cc6d81712c..c32fa96008b 100644
--- a/sys/dev/usb/usbdi.c
+++ b/sys/dev/usb/usbdi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbdi.c,v 1.31 2007/06/05 08:43:56 mbalmer Exp $ */
+/* $OpenBSD: usbdi.c,v 1.32 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: usbdi.c,v 1.103 2002/09/27 15:37:38 provos Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */
@@ -384,7 +384,7 @@ usbd_alloc_xfer(usbd_device_handle dev)
if (xfer == NULL)
return (NULL);
xfer->device = dev;
- usb_callout_init(xfer->timeout_handle);
+ timeout_set(&xfer->timeout_handle, NULL, NULL);
DPRINTFN(5,("usbd_alloc_xfer() = %p\n", xfer));
return (xfer);
}
diff --git a/sys/dev/usb/usbdivar.h b/sys/dev/usb/usbdivar.h
index 086b497c853..ff128f88920 100644
--- a/sys/dev/usb/usbdivar.h
+++ b/sys/dev/usb/usbdivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbdivar.h,v 1.27 2007/06/06 19:25:49 mk Exp $ */
+/* $OpenBSD: usbdivar.h,v 1.28 2007/06/10 10:15:35 mbalmer Exp $ */
/* $NetBSD: usbdivar.h,v 1.70 2002/07/11 21:14:36 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */
@@ -124,7 +124,7 @@ struct usbd_bus {
#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
void *soft; /* soft interrupt cookie */
#else
- usb_callout_t softi;
+ struct timeout softi;
#endif
#endif
bus_dma_tag_t dmatag; /* DMA tag */
@@ -221,7 +221,7 @@ struct usbd_xfer {
void *hcpriv; /* private use by the HC driver */
- usb_callout_t timeout_handle;
+ struct timeout timeout_handle;
};
void usbd_init(void);
diff --git a/sys/dev/usb/usbf_subr.c b/sys/dev/usb/usbf_subr.c
index 80e304fcb39..dc87c1c6089 100644
--- a/sys/dev/usb/usbf_subr.c
+++ b/sys/dev/usb/usbf_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbf_subr.c,v 1.3 2007/02/13 18:32:57 drahn Exp $ */
+/* $OpenBSD: usbf_subr.c,v 1.4 2007/06/10 10:15:35 mbalmer Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -810,7 +810,7 @@ usbf_alloc_xfer(usbf_device_handle dev)
if (xfer == NULL)
return NULL;
xfer->device = dev;
- usb_callout_init(xfer->timeout_handle);
+ timeout_set(&xfer->timeout_handle, NULL, NULL);
DPRINTF(1,("usbf_alloc_xfer() = %p\n", xfer));
return xfer;
}
@@ -1074,7 +1074,7 @@ usbf_softintr_establish(struct usbf_bus *bus)
if (bus->soft == NULL)
return USBF_INVAL;
#else
- usb_callout_init(bus->softi);
+ timeout_set(&bus->softi, NULLL, NULL);
#endif
#endif
return USBF_NORMAL_COMPLETION;
@@ -1087,9 +1087,11 @@ usbf_schedsoftintr(struct usbf_bus *bus)
#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
softintr_schedule(bus->soft);
#else
- if (!usb_callout_pending(bus->softi))
- usb_callout(bus->softi, 0, bus->methods->soft_intr,
- bus);
+ if (!timeout_pending(&bus->softi)) {
+ timeout_del(&bus->softi);
+ timeout_set(&bus->softi, bus->methods->soft_intr, bus);
+ timeout_add(&bus->softi, 0);
+ }
#endif /* __HAVE_GENERIC_SOFT_INTERRUPTS */
#else
bus->methods->soft_intr(bus);
diff --git a/sys/dev/usb/usbfvar.h b/sys/dev/usb/usbfvar.h
index 2d684d18cee..74d4e41cc92 100644
--- a/sys/dev/usb/usbfvar.h
+++ b/sys/dev/usb/usbfvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbfvar.h,v 1.2 2007/06/06 19:25:50 mk Exp $ */
+/* $OpenBSD: usbfvar.h,v 1.3 2007/06/10 10:15:35 mbalmer Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -105,7 +105,7 @@ struct usbf_bus {
#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
void *soft; /* soft interrupt cookie */
#else
- usb_callout_t softi; /* timeout handle */
+ struct timeout softi; /* timeout handle */
#endif
#endif
bus_dma_tag_t dmatag; /* DMA tag */
@@ -151,7 +151,7 @@ struct usbf_xfer {
int rqflags;
usb_dma_t dmabuf;
- usb_callout_t timeout_handle;
+ struct timeout timeout_handle;
};