diff options
author | phk <phk@FreeBSD.org> | 2004-09-17 11:04:57 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-09-17 11:04:57 +0000 |
commit | 4102823a7f2ce97195d991c588e46c8554190c09 (patch) | |
tree | 31e348ac71780f83b274bde3b8b3078e3aa72723 /sys/alpha | |
parent | caa914df82800af01af8f6f18796bbf330fc858f (diff) | |
download | FreeBSD-src-4102823a7f2ce97195d991c588e46c8554190c09.zip FreeBSD-src-4102823a7f2ce97195d991c588e46c8554190c09.tar.gz |
Allocate tty at attach time instead of open time.
Diffstat (limited to 'sys/alpha')
-rw-r--r-- | sys/alpha/tlsb/zs_tlsb.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c index 420d685..84f7e83 100644 --- a/sys/alpha/tlsb/zs_tlsb.c +++ b/sys/alpha/tlsb/zs_tlsb.c @@ -115,11 +115,23 @@ static int zs_attach(device_t dev) { struct zs_softc *sc = device_get_softc(dev); + struct cdev *cdev; + struct tty *tp; + int unit; + sc->dev = dev; sc->channel = zsc_get_channel(dev); sc->base = zsc_get_base(dev); - make_dev(&zs_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, - "zs%d", device_get_unit(dev)); + unit = device_get_unit(dev); + cdev = make_dev(&zs_cdevsw, unit, UID_ROOT, GID_WHEEL, 0600, + "zs%d", unit); + tp = sc->tp = cdev->si_tty = ttyalloc(); + cdev->si_drv1 = sc; + cdev->si_tty = tp; + tp->t_oproc = zsstart; + tp->t_param = zsparam; + tp->t_stop = zsstop; + tp->t_dev = cdev; return 0; } @@ -224,7 +236,6 @@ zs_cnattach(vm_offset_t base, vm_offset_t offset) sprintf(zs_consdev.cn_name, "zs0"); zs_consdev.cn_unit = 0; zs_consdev.cn_pri = CN_NORMAL; - make_dev(&zs_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "zs0"); cnadd(&zs_consdev); return (0); } @@ -259,20 +270,17 @@ zs_cnputc(struct consdev *cp, int c) static int zsopen(struct cdev *dev, int flag, int mode, struct thread *td) { - struct zs_softc *sc = ZS_SOFTC(minor(dev)); + struct zs_softc *sc; struct tty *tp; int error = 0, setuptimeout = 0; int s; + sc = dev->si_drv1; if (!sc) return ENXIO; s = spltty(); - tp = sc->tp = dev->si_tty = ttymalloc(sc->tp); - tp->t_oproc = zsstart; - tp->t_param = zsparam; - tp->t_stop = zsstop; - tp->t_dev = dev; + tp = dev->si_tty; if ((tp->t_state & TS_ISOPEN) == 0) { tp->t_state |= TS_CARR_ON; ttychars(tp); |