diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-08-08 21:49:17 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-08-08 21:49:17 +0000 |
commit | 1297bdd5a1b4b45eba1c77970f67a00ac7762d48 (patch) | |
tree | 613579ce212b3bede5138846193c94c6603e4aa4 /sys/dev | |
parent | f3455e263ff19d86f0a6c8faae0fc6ac7e00e23d (diff) |
New timeouts, drahn@ sez go ahead.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ofw/ofcons.c | 24 | ||||
-rw-r--r-- | sys/dev/ofw/ofnet.c | 9 |
2 files changed, 20 insertions, 13 deletions
diff --git a/sys/dev/ofw/ofcons.c b/sys/dev/ofw/ofcons.c index efc3a4cae05..28e0195eedd 100644 --- a/sys/dev/ofw/ofcons.c +++ b/sys/dev/ofw/ofcons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofcons.c,v 1.4 2000/07/19 13:54:17 art Exp $ */ +/* $OpenBSD: ofcons.c,v 1.5 2001/08/08 21:49:15 miod Exp $ */ /* $NetBSD: ofcons.c,v 1.3 1996/10/13 01:38:11 christos Exp $ */ /* @@ -47,6 +47,7 @@ struct ofc_softc { struct device of_dev; struct tty *of_tty; int of_flags; + struct timeout of_tmo; }; /* flags: */ #define OFPOLL 1 @@ -82,18 +83,21 @@ ofcmatch(parent, match, aux) || OF_instance_to_package(stdout) == ofp->phandle; } +static void ofcstart __P((struct tty *)); +static int ofcparam __P((struct tty *, struct termios *)); +static void ofcpoll __P((void *)); + static void ofcattach(parent, self, aux) struct device *parent, *self; void *aux; { + struct ofc_softc *sc = (void *)self: + + timeout_set(&sc->of_tmo, ofcpoll, sc); printf("\n"); } -static void ofcstart __P((struct tty *)); -static int ofcparam __P((struct tty *, struct termios *)); -static void ofcpoll __P((void *)); - int ofcopen(dev, flag, mode, p) dev_t dev; @@ -130,7 +134,7 @@ ofcopen(dev, flag, mode, p) if (!(sc->of_flags & OFPOLL)) { sc->of_flags |= OFPOLL; - timeout(ofcpoll, sc, 1); + timeout_add(&sc->of_tmo, 1); } return (*linesw[tp->t_line].l_open)(dev, tp); @@ -145,7 +149,7 @@ ofcclose(dev, flag, mode, p) struct ofc_softc *sc = ofcons_cd.cd_devs[minor(dev)]; struct tty *tp = sc->of_tty; - untimeout(ofcpoll, sc); + timeout_del(&sc->of_tmo); sc->of_flags &= ~OFPOLL; (*linesw[tp->t_line].l_close)(tp, flag); ttyclose(tp); @@ -268,7 +272,7 @@ ofcpoll(aux) if (tp && (tp->t_state & TS_ISOPEN)) (*linesw[tp->t_line].l_rint)(ch, tp); } - timeout(ofcpoll, sc, 1); + timeout_add(&of->of_tmo, 1); } static int @@ -348,12 +352,12 @@ ofccnpollc(dev, on) return; if (on) { if (sc->of_flags & OFPOLL) - untimeout(ofcpoll, sc); + timeout_del(&of->of_tmo); sc->of_flags &= ~OFPOLL; } else { if (!(sc->of_flags & OFPOLL)) { sc->of_flags |= OFPOLL; - timeout(ofcpoll, sc, 1); + timeout_add(&of->of_tmo, 1); } } } diff --git a/sys/dev/ofw/ofnet.c b/sys/dev/ofw/ofnet.c index 0d7e9ae6e1a..d252885e603 100644 --- a/sys/dev/ofw/ofnet.c +++ b/sys/dev/ofw/ofnet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofnet.c,v 1.5 2001/06/25 04:47:33 fgsch Exp $ */ +/* $OpenBSD: ofnet.c,v 1.6 2001/08/08 21:49:16 miod Exp $ */ /* $NetBSD: ofnet.c,v 1.4 1996/10/16 19:33:21 ws Exp $ */ /* @@ -69,6 +69,7 @@ struct ofn_softc { int sc_phandle; int sc_ihandle; struct arpcom sc_arpcom; + struct timeout sc_tmo; void *dmabuf; }; @@ -162,6 +163,8 @@ printf("\nethernet dev: path %s\n", path); ifp->if_watchdog = ofnwatchdog; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS; + timeout_set(&of->sc_tmo, ofntimer, of); + if_attach(ifp); ether_ifattach(ifp); @@ -246,7 +249,7 @@ ofntimer(of) struct ofn_softc *of; { ofnread(of); - timeout(ofntimer, of, 1); + timeout_add(&of->sc_tmo, 1); } static void @@ -269,7 +272,7 @@ static void ofnstop(of) struct ofn_softc *of; { - untimeout(ofntimer, of); + timeout_del(&of->sc_tmo); of->sc_arpcom.ac_if.if_flags &= ~IFF_RUNNING; } |