summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Knudsen <mk@cvs.openbsd.org>2008-04-16 16:08:40 +0000
committerMichael Knudsen <mk@cvs.openbsd.org>2008-04-16 16:08:40 +0000
commit6f7bf811629949f5c95dfb3b40982cfb39e2230f (patch)
tree289b4c48f7cd45799569a19461211a8d2ddae44c
parent560b073980818797b7b5d4803628f4ef68625d34 (diff)
Use the timeout(9) API the right way: Don't initialize the timeout
cookie all the time, and only call timeout_del if we're not going to timeout_add right away. Testing by johan@, oga@, sthen@, and possibly some more people (thanks). Ok krw@, oga@, sthen@.
-rw-r--r--sys/dev/usb/ehci.c10
-rw-r--r--sys/dev/usb/ukbd.c6
2 files changed, 6 insertions, 10 deletions
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c
index 9ab378fb69f..992b48c05e4 100644
--- a/sys/dev/usb/ehci.c
+++ b/sys/dev/usb/ehci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ehci.c,v 1.77 2007/06/15 11:41:47 mbalmer Exp $ */
+/* $OpenBSD: ehci.c,v 1.78 2008/04/16 16:08:39 mk Exp $ */
/* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */
/*
@@ -472,8 +472,8 @@ ehci_init(ehci_softc_t *sc)
sc->sc_async_head = sqh;
EOWRITE4(sc, EHCI_ASYNCLISTADDR, sqh->physaddr | EHCI_LINK_QH);
- timeout_set(&sc->sc_tmo_pcd, NULL, NULL);
- timeout_set(&sc->sc_tmo_intrlist, NULL, NULL);
+ timeout_set(&sc->sc_tmo_pcd, ehci_pcd_enable, sc);
+ timeout_set(&sc->sc_tmo_intrlist, ehci_intrlist_timeout, sc);
rw_init(&sc->sc_doorbell_lock, "ehcidb");
@@ -587,8 +587,6 @@ ehci_intr1(ehci_softc_t *sc)
*/
ehci_pcd_able(sc, 0);
/* Do not allow RHSC interrupts > 1 per second */
- 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;
}
@@ -679,8 +677,6 @@ 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)) {
- timeout_del(&sc->sc_tmo_intrlist);
- timeout_set(&sc->sc_tmo_intrlist, ehci_intrlist_timeout, sc);
timeout_add(&sc->sc_tmo_intrlist, hz);
}
diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c
index d73e1bb7ca9..ff6c16459cd 100644
--- a/sys/dev/usb/ukbd.c
+++ b/sys/dev/usb/ukbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ukbd.c,v 1.39 2008/01/24 14:50:38 robert Exp $ */
+/* $OpenBSD: ukbd.c,v 1.40 2008/04/16 16:08:39 mk Exp $ */
/* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -735,12 +735,12 @@ ukbd_decode(struct ukbd_softc *sc, struct ukbd_data *ud)
s = spltty();
wskbd_rawinput(sc->sc_wskbddev, cbuf, j);
splx(s);
- timeout_del(&sc->sc_rawrepeat_ch);
if (npress != 0) {
sc->sc_nrep = npress;
timeout_add(&sc->sc_rawrepeat_ch,
hz * REP_DELAY1 / 1000);
- }
+ } else
+ timeout_del(&sc->sc_rawrepeat_ch);
return;
}
#endif