Index: digi.c =================================================================== RCS file: /usr/local/cvs/src/sys/dev/digi/digi.c,v retrieving revision 1.55 diff -u -r1.55 digi.c --- digi.c 28 Jul 2004 21:06:13 -0000 1.55 +++ digi.c 18 Dec 2004 04:27:20 -0000 @@ -538,16 +538,14 @@ device_printf(sc->dev, "%s, %d ports found\n", sc->name, sc->numports); - if (sc->ports) + if (sc->ports) { + for (i = 0; i < sc->numports; i++) + ttyrel(sc->ports[i].tp); free(sc->ports, M_TTYS); + } sc->ports = malloc(sizeof(struct digi_p) * sc->numports, M_TTYS, M_WAITOK | M_ZERO); - if (sc->ttys) - free(sc->ttys, M_TTYS); - sc->ttys = malloc(sizeof(struct tty) * sc->numports, - M_TTYS, M_WAITOK | M_ZERO); - /* * XXX Should read port 0xc90 for an array of 2byte values, 1 per * port. If the value is 0, the port is broken.... @@ -567,7 +565,7 @@ port->pnum = i; port->sc = sc; port->status = ENABLED; - port->tp = sc->ttys + i; + port->tp = ttymalloc(NULL); port->bc = bc; if (sc->model == PCXEVE) { @@ -958,7 +956,7 @@ sc = (struct digi_softc *)devclass_get_softc(digi_devclass, unit); KASSERT(sc, ("digi%d: softc not allocated in digiclose\n", unit)); - tp = &sc->ttys[pnum]; + tp = sc->ports[pnum].tp; error = ttyld_read(tp, uio, flag); DLOG(DIGIDB_READ, (sc->dev, "port %d: read() returns %d\n", @@ -984,7 +982,7 @@ sc = (struct digi_softc *)devclass_get_softc(digi_devclass, unit); KASSERT(sc, ("digi%d: softc not allocated in digiclose\n", unit)); - tp = &sc->ttys[pnum]; + tp = sc->ports[pnum].tp; error = ttyld_write(tp, uio, flag); DLOG(DIGIDB_WRITE, (sc->dev, "port %d: write() returns %d\n", @@ -1829,7 +1827,7 @@ int i; for (i = 0; i < sc->numports; i++) - if (sc->ttys[i].t_state & TS_ISOPEN) { + if (sc->ports[i].tp->t_state & TS_ISOPEN) { DLOG(DIGIDB_INIT, (sc->dev, "port%d: busy\n", i)); return (1); } else if (sc->ports[i].wopeners || sc->ports[i].opencnt) { @@ -1866,11 +1864,10 @@ #endif if (sc->numports) { KASSERT(sc->ports, ("digi%d: Lost my ports ?", sc->res.unit)); - KASSERT(sc->ttys, ("digi%d: Lost my ttys ?", sc->res.unit)); + for (i = 0; i < sc->numports; i++) + ttyrel(sc->ports[i].tp); free(sc->ports, M_TTYS); sc->ports = NULL; - free(sc->ttys, M_TTYS); - sc->ttys = NULL; sc->numports = 0; } Index: digi.h =================================================================== RCS file: /usr/local/cvs/src/sys/dev/digi/digi.h,v retrieving revision 1.17 diff -u -r1.17 digi.h --- digi.h 11 Jul 2004 15:18:37 -0000 1.17 +++ digi.h 18 Dec 2004 04:27:20 -0000 @@ -177,7 +177,6 @@ #endif struct digi_p *ports; /* pointer to array of port descriptors */ - struct tty *ttys; /* pointer to array of TTY structures */ volatile struct global_data *gdata; u_char window; /* saved window */ int win_size;