summaryrefslogtreecommitdiff
path: root/sys/dev/ofw/ofcons.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ofw/ofcons.c')
-rw-r--r--sys/dev/ofw/ofcons.c24
1 files changed, 14 insertions, 10 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);
}
}
}