summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorMarc Balmer <mbalmer@cvs.openbsd.org>2007-11-23 15:43:03 +0000
committerMarc Balmer <mbalmer@cvs.openbsd.org>2007-11-23 15:43:03 +0000
commitc1c4b626b699581b962cfad225cc35995f811251 (patch)
tree182988f9093b3f2c927fe6cf9d2d23199a20de4a /sys/dev/usb
parentfc18ac9085d0963e9ca450f94e6bf954e9f30ef9 (diff)
Sanitize the use of timeouts:
Instead of calling timeout_set(..., NULL, NULL) in attach routines and later timeout_del(...) timeout_set(..., func, arg) timeout_add(..., time) set the function and argument in the initial timeout_set() call and only use timeout_add(..., time) later. ok dlg, fgsch, krw, winiger
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/if_aue.c8
-rw-r--r--sys/dev/usb/if_axe.c8
-rw-r--r--sys/dev/usb/if_cue.c6
-rw-r--r--sys/dev/usb/if_udav.c8
-rw-r--r--sys/dev/usb/if_url.c8
-rw-r--r--sys/dev/usb/ohci.c6
-rw-r--r--sys/dev/usb/ukbd.c14
7 files changed, 15 insertions, 43 deletions
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index 7743e2bfda6..4ab7ab02160 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.68 2007/11/10 22:58:24 deraadt Exp $ */
+/* $OpenBSD: if_aue.c,v 1.69 2007/11/23 15:43:02 mbalmer Exp $ */
/* $NetBSD: if_aue.c,v 1.82 2003/03/05 17:37:36 shiba Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -830,7 +830,7 @@ aue_attach(struct device *parent, struct device *self, void *aux)
if_attach(ifp);
ether_ifattach(ifp);
- timeout_set(&sc->aue_stat_ch, NULL, NULL);
+ timeout_set(&sc->aue_stat_ch, aue_tick, sc);
sc->aue_attached = 1;
sc->sc_sdhook = shutdownhook_establish(aue_shutdown, sc);
@@ -1245,8 +1245,6 @@ aue_tick_task(void *xsc)
aue_start(ifp);
}
- timeout_del(&sc->aue_stat_ch);
- timeout_set(&sc->aue_stat_ch, aue_tick, sc);
timeout_add(&sc->aue_stat_ch, hz);
splx(s);
@@ -1417,8 +1415,6 @@ aue_init(void *xsc)
splx(s);
- timeout_del(&sc->aue_stat_ch);
- timeout_set(&sc->aue_stat_ch, aue_tick, sc);
timeout_add(&sc->aue_stat_ch, hz);
}
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c
index 872ff5cb747..cdb94691871 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.80 2007/10/27 22:12:41 jsg Exp $ */
+/* $OpenBSD: if_axe.c,v 1.81 2007/11/23 15:43:02 mbalmer Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Jonathan Gray <jsg@openbsd.org>
@@ -723,7 +723,7 @@ axe_attach(struct device *parent, struct device *self, void *aux)
if_attach(ifp);
ether_ifattach(ifp);
- timeout_set(&sc->axe_stat_ch, NULL, NULL);
+ timeout_set(&sc->axe_stat_ch, axe_tick, sc);
sc->axe_attached = 1;
splx(s);
@@ -1120,8 +1120,6 @@ axe_tick_task(void *xsc)
axe_start(ifp);
}
- timeout_del(&sc->axe_stat_ch);
- timeout_set(&sc->axe_stat_ch, axe_tick, sc);
timeout_add(&sc->axe_stat_ch, hz);
splx(s);
@@ -1321,8 +1319,6 @@ axe_init(void *xsc)
splx(s);
- timeout_del(&sc->axe_stat_ch);
- timeout_set(&sc->axe_stat_ch, axe_tick, sc);
timeout_add(&sc->axe_stat_ch, hz);
return;
}
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index e294df90c93..b84ecbd528e 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.47 2007/10/11 18:33:14 deraadt Exp $ */
+/* $OpenBSD: if_cue.c,v 1.48 2007/11/23 15:43:02 mbalmer Exp $ */
/* $NetBSD: if_cue.c,v 1.40 2002/07/11 21:14:26 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -537,7 +537,7 @@ cue_attach(struct device *parent, struct device *self, void *aux)
if_attach(ifp);
ether_ifattach(ifp);
- timeout_set(&sc->cue_stat_ch, NULL, NULL);
+ timeout_set(&sc->cue_stat_ch, cue_tick, sc);
sc->cue_attached = 1;
splx(s);
@@ -1056,8 +1056,6 @@ cue_init(void *xsc)
splx(s);
- timeout_del(&sc->cue_stat_ch);
- timeout_set(&sc->cue_stat_ch, cue_tick, sc);
timeout_add(&sc->cue_stat_ch, hz);
}
diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c
index 46b0afd6a97..028ddc22dde 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.39 2007/11/01 17:10:34 deraadt Exp $ */
+/* $OpenBSD: if_udav.c,v 1.40 2007/11/23 15:43:02 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 $ */
/*
@@ -305,7 +305,7 @@ udav_attach(struct device *parent, struct device *self, void *aux)
if_attach(ifp);
ether_ifattach(ifp);
- timeout_set(&sc->sc_stat_ch, NULL, NULL);
+ timeout_set(&sc->sc_stat_ch, udav_tick, sc);
sc->sc_attached = 1;
splx(s);
@@ -683,8 +683,6 @@ udav_init(struct ifnet *ifp)
splx(s);
- timeout_del(&sc->sc_stat_ch);
- timeout_set(&sc->sc_stat_ch, udav_tick, sc);
timeout_add(&sc->sc_stat_ch, hz);
return (0);
@@ -1499,8 +1497,6 @@ udav_tick_task(void *xsc)
udav_start(ifp);
}
- 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_url.c b/sys/dev/usb/if_url.c
index 6c45ad8e1f3..dff0568c6c4 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.49 2007/10/11 18:33:14 deraadt Exp $ */
+/* $OpenBSD: if_url.c,v 1.50 2007/11/23 15:43:02 mbalmer Exp $ */
/* $NetBSD: if_url.c,v 1.6 2002/09/29 10:19:21 martin Exp $ */
/*
* Copyright (c) 2001, 2002
@@ -310,7 +310,7 @@ url_attach(struct device *parent, struct device *self, void *aux)
if_attach(ifp);
ether_ifattach(ifp);
- timeout_set(&sc->sc_stat_ch, NULL, NULL);
+ timeout_set(&sc->sc_stat_ch, url_tick, sc);
sc->sc_attached = 1;
splx(s);
@@ -574,8 +574,6 @@ url_init(struct ifnet *ifp)
splx(s);
- timeout_del(&sc->sc_stat_ch);
- timeout_set(&sc->sc_stat_ch, url_tick, sc);
timeout_add(&sc->sc_stat_ch, hz);
return (0);
@@ -1383,8 +1381,6 @@ url_tick_task(void *xsc)
url_start(ifp);
}
- 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/ohci.c b/sys/dev/usb/ohci.c
index f9da679893f..f8b4716cc64 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci.c,v 1.84 2007/06/15 11:41:48 mbalmer Exp $ */
+/* $OpenBSD: ohci.c,v 1.85 2007/11/23 15:43:02 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 $ */
@@ -865,7 +865,7 @@ ohci_init(ohci_softc_t *sc)
sc->sc_control = sc->sc_intre = 0;
sc->sc_shutdownhook = shutdownhook_establish(ohci_shutdown, sc);
- timeout_set(&sc->sc_tmo_rhsc, NULL, NULL);
+ timeout_set(&sc->sc_tmo_rhsc, ohci_rhsc_enable, sc);
/* Finally, turn on interrupts. */
DPRINTFN(1,("ohci_init: enabling\n"));
@@ -1188,8 +1188,6 @@ ohci_intr1(ohci_softc_t *sc)
sc->sc_bus.bdev.dv_xname));
/* Do not allow RHSC interrupts > 1 per second */
- 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;
}
diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c
index 8f7868a64c4..d0e4170d128 100644
--- a/sys/dev/usb/ukbd.c
+++ b/sys/dev/usb/ukbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ukbd.c,v 1.36 2007/06/14 10:11:16 mbalmer Exp $ */
+/* $OpenBSD: ukbd.c,v 1.37 2007/11/23 15:43:02 mbalmer Exp $ */
/* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -453,8 +453,8 @@ ukbd_attach(struct device *parent, struct device *self, void *aux)
a.accessops = &ukbd_accessops;
a.accesscookie = sc;
- timeout_set(&sc->sc_rawrepeat_ch, NULL, NULL);
- timeout_set(&sc->sc_delay, NULL, NULL);
+ timeout_set(&sc->sc_rawrepeat_ch, ukbd_rawrepeat, sc);
+ timeout_set(&sc->sc_delay, ukbd_delayed_decode, sc);
/* Flash the leds; no real purpose, just shows we're alive. */
ukbd_set_leds(sc, WSKBD_LED_SCROLL | WSKBD_LED_NUM | WSKBD_LED_CAPS);
@@ -583,8 +583,6 @@ 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;
- 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) {
@@ -595,8 +593,6 @@ ukbd_intr(struct uhidev *addr, void *ibuf, u_int len)
* loses bigtime.
*/
sc->sc_data = *ud;
- timeout_del(&sc->sc_delay);
- timeout_set(&sc->sc_delay, ukbd_delayed_decode, sc);
timeout_add(&sc->sc_delay, 1);
#endif
} else {
@@ -733,8 +729,6 @@ ukbd_decode(struct ukbd_softc *sc, struct ukbd_data *ud)
timeout_del(&sc->sc_rawrepeat_ch);
if (npress != 0) {
sc->sc_nrep = npress;
- 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);
}
@@ -788,8 +782,6 @@ ukbd_rawrepeat(void *v)
s = spltty();
wskbd_rawinput(sc->sc_wskbddev, sc->sc_rep, sc->sc_nrep);
splx(s);
- 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