diff options
author | phk <phk@FreeBSD.org> | 1999-09-25 16:21:39 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-09-25 16:21:39 +0000 |
commit | a2c68c62dba7acc1de5dd6a6141484d9c12844fe (patch) | |
tree | c55829a482e5222c5ae63cf589d4fd2a7ec13aec /sys/dev | |
parent | 869afb6bbe2f0a063d91bf2099b7121d2d03c1b2 (diff) | |
download | FreeBSD-src-a2c68c62dba7acc1de5dd6a6141484d9c12844fe.zip FreeBSD-src-a2c68c62dba7acc1de5dd6a6141484d9c12844fe.tar.gz |
This patch clears the way for removing a number of tty related
fields in struct cdevsw:
d_stop moved to struct tty.
d_reset already unused.
d_devtotty linkage now provided by dev_t->si_tty.
These fields will be removed from struct cdevsw together with
d_params and d_maxio Real Soon Now.
The changes in this patch consist of:
initialize dev->si_tty in *_open()
initialize tty->t_stop
remove devtotty functions
rename ttpoll to ttypoll
a few adjustments to these changes in the generic code
a bump of __FreeBSD_version
add a couple of FreeBSD tags
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/cy/cy.c | 36 | ||||
-rw-r--r-- | sys/dev/cy/cy_isa.c | 36 | ||||
-rw-r--r-- | sys/dev/dgb/dgb.c | 31 | ||||
-rw-r--r-- | sys/dev/dgb/dgm.c | 31 | ||||
-rw-r--r-- | sys/dev/rc/rc.c | 32 | ||||
-rw-r--r-- | sys/dev/rp/rp.c | 39 | ||||
-rw-r--r-- | sys/dev/si/si.c | 32 | ||||
-rw-r--r-- | sys/dev/sio/sio.c | 30 | ||||
-rw-r--r-- | sys/dev/snp/snp.c | 6 | ||||
-rw-r--r-- | sys/dev/syscons/scvesactl.c | 2 | ||||
-rw-r--r-- | sys/dev/syscons/syscons.c | 12 | ||||
-rw-r--r-- | sys/dev/syscons/syscons.h | 1 |
12 files changed, 73 insertions, 215 deletions
diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 4181c44..8f2109c 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -123,7 +123,6 @@ #define p_com_addr p_cy_addr #define sioattach cyattach #define sioclose cyclose -#define siodevtotty cydevtotty #define siodriver cydriver #define siodtrwakeup cydtrwakeup #define sioinput cyinput @@ -136,7 +135,7 @@ #define sioread cyread #define siosettimeout cysettimeout #define siosetwater cysetwater -#define siostop cystop +#define comstop cystop #define siowrite cywrite #define sio_registered cy_registered #define sio_timeout cy_timeout @@ -179,7 +178,7 @@ * * The following com and tty flags correspond closely: * CS_BUSY = TS_BUSY (maintained by comstart(), siopoll() and - * siostop()) + * comstop()) * CS_TTGO = ~TS_TTSTOP (maintained by comparam() and comstart()) * CS_CTS_OFLOW = CCTS_OFLOW (maintained by comparam()) * CS_RTS_IFLOW = CRTS_IFLOW (maintained by comparam()) @@ -347,6 +346,7 @@ static int siosetwater __P((struct com_s *com, speed_t speed)); static int comspeed __P((speed_t speed, u_long cy_clock, int *prescaler_io)); static void comstart __P((struct tty *tp)); +static void comstop __P((struct tty *tp, int rw)); static timeout_t comwakeup; static void disc_optim __P((struct tty *tp, struct termios *t, struct com_s *com)); @@ -370,8 +370,6 @@ static d_close_t sioclose; static d_read_t sioread; static d_write_t siowrite; static d_ioctl_t sioioctl; -static d_stop_t siostop; -static d_devtotty_t siodevtotty; #define CDEV_MAJOR 48 static struct cdevsw sio_cdevsw = { @@ -380,10 +378,10 @@ static struct cdevsw sio_cdevsw = { /* read */ sioread, /* write */ siowrite, /* ioctl */ sioioctl, - /* stop */ siostop, + /* stop */ nostop, /* reset */ noreset, - /* devtotty */ siodevtotty, - /* poll */ ttpoll, + /* devtotty */ nodevtotty, + /* poll */ ttypoll, /* mmap */ nommap, /* strategy */ nostrategy, /* name */ driver_name, @@ -674,6 +672,7 @@ sioopen(dev, flag, mode, p) #else tp = com->tp = &sio_tty[unit]; #endif + dev->si_tty = tp; s = spltty(); /* * We jump to this label after all non-interrupted sleeps to pick @@ -721,6 +720,7 @@ open_top: * callout, and to complete a callin open after DCD rises. */ tp->t_oproc = comstart; + tp->t_stop = comstop; tp->t_param = comparam; tp->t_dev = dev; tp->t_termios = mynor & CALLOUT_MASK @@ -853,7 +853,7 @@ sioclose(dev, flag, mode, p) cd_etc(com, CD1400_ETC_STOPBREAK); (*linesw[tp->t_line].l_close)(tp, flag); disc_optim(tp, &tp->t_termios, com); - siostop(tp, FREAD | FWRITE); + comstop(tp, FREAD | FWRITE); comhardclose(com); ttyclose(tp); siosettimeout(); @@ -2414,7 +2414,7 @@ comstart(tp) } static void -siostop(tp, rw) +comstop(tp, rw) struct tty *tp; int rw; { @@ -2454,22 +2454,6 @@ siostop(tp, rw) comstart(tp); } -static struct tty * -siodevtotty(dev) - dev_t dev; -{ - int mynor; - int unit; - - mynor = minor(dev); - if (mynor & CONTROL_MASK) - return (NULL); - unit = MINOR_TO_UNIT(mynor); - if ((u_int) unit >= NSIO) - return (NULL); - return (&sio_tty[unit]); -} - static int commctl(com, bits, how) struct com_s *com; diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index 4181c44..8f2109c 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -123,7 +123,6 @@ #define p_com_addr p_cy_addr #define sioattach cyattach #define sioclose cyclose -#define siodevtotty cydevtotty #define siodriver cydriver #define siodtrwakeup cydtrwakeup #define sioinput cyinput @@ -136,7 +135,7 @@ #define sioread cyread #define siosettimeout cysettimeout #define siosetwater cysetwater -#define siostop cystop +#define comstop cystop #define siowrite cywrite #define sio_registered cy_registered #define sio_timeout cy_timeout @@ -179,7 +178,7 @@ * * The following com and tty flags correspond closely: * CS_BUSY = TS_BUSY (maintained by comstart(), siopoll() and - * siostop()) + * comstop()) * CS_TTGO = ~TS_TTSTOP (maintained by comparam() and comstart()) * CS_CTS_OFLOW = CCTS_OFLOW (maintained by comparam()) * CS_RTS_IFLOW = CRTS_IFLOW (maintained by comparam()) @@ -347,6 +346,7 @@ static int siosetwater __P((struct com_s *com, speed_t speed)); static int comspeed __P((speed_t speed, u_long cy_clock, int *prescaler_io)); static void comstart __P((struct tty *tp)); +static void comstop __P((struct tty *tp, int rw)); static timeout_t comwakeup; static void disc_optim __P((struct tty *tp, struct termios *t, struct com_s *com)); @@ -370,8 +370,6 @@ static d_close_t sioclose; static d_read_t sioread; static d_write_t siowrite; static d_ioctl_t sioioctl; -static d_stop_t siostop; -static d_devtotty_t siodevtotty; #define CDEV_MAJOR 48 static struct cdevsw sio_cdevsw = { @@ -380,10 +378,10 @@ static struct cdevsw sio_cdevsw = { /* read */ sioread, /* write */ siowrite, /* ioctl */ sioioctl, - /* stop */ siostop, + /* stop */ nostop, /* reset */ noreset, - /* devtotty */ siodevtotty, - /* poll */ ttpoll, + /* devtotty */ nodevtotty, + /* poll */ ttypoll, /* mmap */ nommap, /* strategy */ nostrategy, /* name */ driver_name, @@ -674,6 +672,7 @@ sioopen(dev, flag, mode, p) #else tp = com->tp = &sio_tty[unit]; #endif + dev->si_tty = tp; s = spltty(); /* * We jump to this label after all non-interrupted sleeps to pick @@ -721,6 +720,7 @@ open_top: * callout, and to complete a callin open after DCD rises. */ tp->t_oproc = comstart; + tp->t_stop = comstop; tp->t_param = comparam; tp->t_dev = dev; tp->t_termios = mynor & CALLOUT_MASK @@ -853,7 +853,7 @@ sioclose(dev, flag, mode, p) cd_etc(com, CD1400_ETC_STOPBREAK); (*linesw[tp->t_line].l_close)(tp, flag); disc_optim(tp, &tp->t_termios, com); - siostop(tp, FREAD | FWRITE); + comstop(tp, FREAD | FWRITE); comhardclose(com); ttyclose(tp); siosettimeout(); @@ -2414,7 +2414,7 @@ comstart(tp) } static void -siostop(tp, rw) +comstop(tp, rw) struct tty *tp; int rw; { @@ -2454,22 +2454,6 @@ siostop(tp, rw) comstart(tp); } -static struct tty * -siodevtotty(dev) - dev_t dev; -{ - int mynor; - int unit; - - mynor = minor(dev); - if (mynor & CONTROL_MASK) - return (NULL); - unit = MINOR_TO_UNIT(mynor); - if ((u_int) unit >= NSIO) - return (NULL); - return (&sio_tty[unit]); -} - static int commctl(com, bits, how) struct com_s *com; diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c index 60008ab..0f24e8c 100644 --- a/sys/dev/dgb/dgb.c +++ b/sys/dev/dgb/dgb.c @@ -188,6 +188,7 @@ static void fepcmd(struct dgb_p *port, unsigned cmd, unsigned op1, unsigned op2, unsigned ncmds, unsigned bytecmd); static void dgbstart __P((struct tty *tp)); +static void dgbstop __P((struct tty *tp, int rw)); static int dgbparam __P((struct tty *tp, struct termios *t)); static void dgbhardclose __P((struct dgb_p *port)); static void dgb_drain_or_flush __P((struct dgb_p *port)); @@ -206,8 +207,6 @@ static d_close_t dgbclose; static d_read_t dgbread; static d_write_t dgbwrite; static d_ioctl_t dgbioctl; -static d_stop_t dgbstop; -static d_devtotty_t dgbdevtotty; #define CDEV_MAJOR 58 static struct cdevsw dgb_cdevsw = { @@ -216,10 +215,10 @@ static struct cdevsw dgb_cdevsw = { /* read */ dgbread, /* write */ dgbwrite, /* ioctl */ dgbioctl, - /* stop */ dgbstop, + /* stop */ nostop, /* reset */ noreset, - /* devtotty */ dgbdevtotty, - /* poll */ ttpoll, + /* devtotty */ nodevtotty, + /* poll */ ttypoll, /* mmap */ nommap, /* strategy */ nostrategy, /* name */ "dgb", @@ -975,6 +974,7 @@ dgbopen(dev, flag, mode, p) return 0; tp=&sc->ttys[pnum]; + dev->si_tty = tp; port=&sc->ports[pnum]; bc=port->brdchan; @@ -1034,6 +1034,7 @@ open_top: */ tp->t_oproc=dgbstart; tp->t_param=dgbparam; + tp->t_stop=dgbstop; tp->t_dev=dev; tp->t_termios= (mynor & CALLOUT_MASK) ? port->it_out : @@ -2184,26 +2185,6 @@ dgbstop(tp, rw) dgbstart(tp); } -struct tty * -dgbdevtotty(dev) - dev_t dev; -{ - int mynor, pnum, unit; - struct dgb_softc *sc; - - mynor = minor(dev); - if (mynor & CONTROL_MASK) - return (NULL); - unit = MINOR_TO_UNIT(mynor); - if ((u_int) unit >= NDGB) - return (NULL); - pnum = MINOR_TO_PORT(mynor); - sc = &dgb_softc[unit]; - if (pnum >= sc->numports) - return (NULL); - return (&sc->ttys[pnum]); -} - static void fepcmd(port, cmd, op1, op2, ncmds, bytecmd) struct dgb_p *port; diff --git a/sys/dev/dgb/dgm.c b/sys/dev/dgb/dgm.c index 5deb61d..ecf6827 100644 --- a/sys/dev/dgb/dgm.c +++ b/sys/dev/dgb/dgm.c @@ -192,6 +192,7 @@ static void fepcmd(struct dgm_p *port, unsigned cmd, unsigned op1, unsigned op2, unsigned ncmds, unsigned bytecmd); static void dgmstart __P((struct tty *tp)); +static void dgmstop __P((struct tty *tp, int rw)); static int dgmparam __P((struct tty *tp, struct termios *t)); static void dgmhardclose __P((struct dgm_p *port)); static void dgm_drain_or_flush __P((struct dgm_p *port)); @@ -210,8 +211,6 @@ static d_close_t dgmclose; static d_read_t dgmread; static d_write_t dgmwrite; static d_ioctl_t dgmioctl; -static d_stop_t dgmstop; -static d_devtotty_t dgmdevtotty; #define CDEV_MAJOR 101 static struct cdevsw dgm_cdevsw = { @@ -220,10 +219,10 @@ static struct cdevsw dgm_cdevsw = { /* read */ dgmread, /* write */ dgmwrite, /* ioctl */ dgmioctl, - /* stop */ dgmstop, + /* stop */ nostop, /* reset */ noreset, - /* devtotty */ dgmdevtotty, - /* poll */ ttpoll, + /* devtotty */ nodevtotty, + /* poll */ ttypoll, /* mmap */ nommap, /* strategy */ nostrategy, /* name */ "dgm", @@ -778,6 +777,7 @@ dgmopen(dev, flag, mode, p) return 0; tp=&sc->ttys[pnum]; + dev->si_tty = tp; port=&sc->ports[pnum]; bc=port->brdchan; @@ -837,6 +837,7 @@ open_top: */ tp->t_oproc=dgmstart; tp->t_param=dgmparam; + tp->t_stop=dgmstop; tp->t_dev=dev; tp->t_termios= (mynor & CALLOUT_MASK) ? port->it_out : @@ -1986,26 +1987,6 @@ dgmstop(tp, rw) dgmstart(tp); } -struct tty * -dgmdevtotty(dev) - dev_t dev; -{ - int mynor, pnum, unit; - struct dgm_softc *sc; - - mynor = minor(dev); - if (mynor & CONTROL_MASK) - return (NULL); - unit = MINOR_TO_UNIT(mynor); - if ((u_int) unit >= NDGM) - return (NULL); - pnum = MINOR_TO_PORT(mynor); - sc = &dgm_softc[unit]; - if (pnum >= sc->numports) - return (NULL); - return (&sc->ttys[pnum]); -} - static void fepcmd(port, cmd, op1, op2, ncmds, bytecmd) struct dgm_p *port; diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index 78dd5f5..238a052 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -23,6 +23,9 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ + * */ /* @@ -87,8 +90,6 @@ static d_close_t rcclose; static d_read_t rcread; static d_write_t rcwrite; static d_ioctl_t rcioctl; -static d_stop_t rcstop; -static d_devtotty_t rcdevtotty; #define CDEV_MAJOR 63 static struct cdevsw rc_cdevsw = { @@ -97,10 +98,10 @@ static struct cdevsw rc_cdevsw = { /* read */ rcread, /* write */ rcwrite, /* ioctl */ rcioctl, - /* stop */ rcstop, + /* stop */ nostop, /* reset */ noreset, - /* devtotty */ rcdevtotty, - /* poll */ ttpoll, + /* devtotty */ nodevtotty, + /* poll */ ttypoll, /* mmap */ nommap, /* strategy */ nostrategy, /* name */ "rc", @@ -182,6 +183,7 @@ static void rc_discard_output __P((struct rc_chans *)); static void rc_hardclose __P((struct rc_chans *)); static int rc_modctl __P((struct rc_chans *, int, int)); static void rc_start __P((struct tty *)); +static void rc_stop __P((struct tty *, int rw)); static int rc_param __P((struct tty *, struct termios *)); static swihand_t rcpoll; static void rc_reinit __P((struct rc_softc *)); @@ -682,7 +684,7 @@ done1: ; } static void -rcstop(tp, rw) +rc_stop(tp, rw) register struct tty *tp; int rw; { @@ -690,7 +692,7 @@ rcstop(tp, rw) u_char *tptr, *eptr; #ifdef RCDEBUG - printf("rc%d/%d: rcstop %s%s\n", rc->rc_rcb->rcb_unit, rc->rc_chan, + printf("rc%d/%d: rc_stop %s%s\n", rc->rc_rcb->rcb_unit, rc->rc_chan, (rw & FWRITE)?"FWRITE ":"", (rw & FREAD)?"FREAD":""); #endif if (rw & FWRITE) @@ -732,6 +734,7 @@ rcopen(dev, flag, mode, p) return ENXIO; rc = &rc_chans[unit]; tp = rc->rc_tp; + dev->si_tty = tp; nec = rc->rc_rcb->rcb_addr; #ifdef RCDEBUG printf("rc%d/%d: rcopen: dev %x\n", rc->rc_rcb->rcb_unit, unit, dev); @@ -771,6 +774,7 @@ again: } else { tp->t_oproc = rc_start; tp->t_param = rc_param; + tp->t_stop = rc_stop; tp->t_dev = dev; if (CALLOUT(dev)) @@ -828,7 +832,7 @@ rcclose(dev, flag, mode, p) s = spltty(); (*linesw[tp->t_line].l_close)(tp, flag); disc_optim(tp, &tp->t_termios, rc); - rcstop(tp, FREAD | FWRITE); + rc_stop(tp, FREAD | FWRITE); rc_hardclose(rc); ttyclose(tp); splx(s); @@ -1407,18 +1411,6 @@ char *comment; } #endif /* RCDEBUG */ -static struct tty * -rcdevtotty(dev) - dev_t dev; -{ - int unit; - - unit = GET_UNIT(dev); - if (unit >= NRC * CD180_NCHAN) - return NULL; - return (&rc_tty[unit]); -} - static void rc_dtrwakeup(chan) void *chan; diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c index a3a4db2..d788b57 100644 --- a/sys/dev/rp/rp.c +++ b/sys/dev/rp/rp.c @@ -797,8 +797,6 @@ static d_close_t rpclose; static d_read_t rpread; static d_write_t rpwrite; static d_ioctl_t rpioctl; -static d_stop_t rpstop; -static d_devtotty_t rpdevtotty; #define CDEV_MAJOR 81 static struct cdevsw rp_cdevsw = { @@ -807,10 +805,10 @@ static struct cdevsw rp_cdevsw = { /* read */ rpread, /* write */ rpwrite, /* ioctl */ rpioctl, - /* stop */ rpstop, + /* stop */ nostop, /* reset */ noreset, - /* devtotty */ rpdevtotty, - /* poll */ ttpoll, + /* devtotty */ nodevtotty, + /* poll */ ttypoll, /* mmap */ nommap, /* strategy */ nostrategy, /* name */ driver_name, @@ -859,10 +857,9 @@ static struct rp_port *p_rp_table[MAX_RP_PORTS]; * The top-level routines begin here */ -int rpselect __P((dev_t, int, struct proc *)); - static int rpparam __P((struct tty *, struct termios *)); static void rpstart __P((struct tty *)); +static void rpstop __P((struct tty *, int)); static void rphardclose __P((struct rp_port *)); #define rpmap nomap #define rpreset noreset @@ -1310,6 +1307,7 @@ rpopen(dev, flag, mode, p) /* rp->rp_tty = &rp_tty[rp->rp_port]; */ tp = rp->rp_tty; + dev->si_tty = tp; oldspl = spltty(); @@ -1349,6 +1347,7 @@ open_top: tp->t_dev = dev; tp->t_param = rpparam; tp->t_oproc = rpstart; + tp->t_stop = rpstop; tp->t_line = 0; tp->t_termios = IS_CALLOUT(dev) ? rp->it_out : rp->it_in; flags = 0; @@ -2017,29 +2016,3 @@ rpstop(tp, flag) splx(spl); rpstart(tp); } - -int -rpselect(dev, flag, p) - dev_t dev; - int flag; - struct proc *p; -{ - return(0); -} - -struct tty * -rpdevtotty(dev_t dev) -{ - struct rp_port *rp; - int unit, port, mynor, umynor; /* SG */ - - umynor = (((minor(dev) >> 16) -1) * 32); /* SG */ - port = (minor(dev) & 0x1f); /* SG */ - mynor = (port + umynor); /* SG */ - unit = minor_to_unit[mynor]; /* SG */ - - if(IS_CONTROL(dev)) - return(NULL); - rp = rp_addr(unit) + port; - return(rp->rp_tty); -} diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index bc26654..a1cde6e 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -113,6 +113,7 @@ static int si_modem __P((struct si_port *, enum si_mctl, int)); static void si_write_enable __P((struct si_port *, int)); static int si_Sioctl __P((dev_t, u_long, caddr_t, int, struct proc *)); static void si_start __P((struct tty *)); +static void si_stop __P((struct tty *, int)); static timeout_t si_lstart; static void si_disc_optim __P((struct tty *tp, struct termios *t, struct si_port *pp)); @@ -171,8 +172,6 @@ static d_close_t siclose; static d_read_t siread; static d_write_t siwrite; static d_ioctl_t siioctl; -static d_stop_t sistop; -static d_devtotty_t sidevtotty; #define CDEV_MAJOR 68 static struct cdevsw si_cdevsw = { @@ -181,10 +180,10 @@ static struct cdevsw si_cdevsw = { /* read */ siread, /* write */ siwrite, /* ioctl */ siioctl, - /* stop */ sistop, + /* stop */ nostop, /* reset */ noreset, - /* devtotty */ sidevtotty, - /* poll */ ttpoll, + /* devtotty */ nodevtotty, + /* poll */ ttypoll, /* mmap */ nommap, /* strategy */ nostrategy, /* name */ "si", @@ -1162,6 +1161,7 @@ siopen(dev, flag, mode, p) pp = sc->sc_ports + port; tp = pp->sp_tty; /* the "real" tty */ + dev->si_tty = tp; ccbp = pp->sp_ccb; /* Find control block */ DPRINT((pp, DBG_ENTRY|DBG_OPEN, "siopen(%s,%x,%x,%x)\n", devtoname(dev), flag, mode, p)); @@ -1213,6 +1213,7 @@ open_top: */ DPRINT((pp, DBG_OPEN, "first open\n")); tp->t_oproc = si_start; + tp->t_stop = si_stop; tp->t_param = siparam; tp->t_dev = dev; tp->t_termios = mynor & SI_CALLOUT_MASK @@ -1327,7 +1328,7 @@ siclose(dev, flag, mode, p) pp->sp_state &= ~SS_LSTART; } - sistop(tp, FREAD | FWRITE); + si_stop(tp, FREAD | FWRITE); sihardclose(pp); ttyclose(tp); @@ -1458,21 +1459,6 @@ out: } -static struct tty * -sidevtotty(dev_t dev) -{ - struct si_port *pp; - int mynor = minor(dev); - struct si_softc *sc = &si_softc[SI_CARD(mynor)]; - - if (IS_SPECIAL(mynor)) - return(NULL); - if (SI_PORT(mynor) >= sc->sc_nport) - return(NULL); - pp = MINOR2PP(mynor); - return (pp->sp_tty); -} - static int siioctl(dev, cmd, data, flag, p) dev_t dev; @@ -2582,7 +2568,7 @@ si_lstart(void *arg) * Stop output on a line. called at spltty(); */ void -sistop(tp, rw) +si_stop(tp, rw) register struct tty *tp; int rw; { @@ -2592,7 +2578,7 @@ sistop(tp, rw) pp = TP2PP(tp); ccbp = pp->sp_ccb; - DPRINT((TP2PP(tp), DBG_ENTRY|DBG_STOP, "sistop(%x,%x)\n", tp, rw)); + DPRINT((TP2PP(tp), DBG_ENTRY|DBG_STOP, "si_stop(%x,%x)\n", tp, rw)); /* XXX: must check (rw & FWRITE | FREAD) etc flushing... */ if (rw & FWRITE) { diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 0e9dcad..28c54db 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -307,6 +307,7 @@ static int sioprobe __P((device_t dev)); static void siosettimeout __P((void)); static int siosetwater __P((struct com_s *com, speed_t speed)); static void comstart __P((struct tty *tp)); +static void comstop __P((struct tty *tp, int rw)); static timeout_t comwakeup; static void disc_optim __P((struct tty *tp, struct termios *t, struct com_s *com)); @@ -338,8 +339,6 @@ static d_close_t sioclose; static d_read_t sioread; static d_write_t siowrite; static d_ioctl_t sioioctl; -static d_stop_t siostop; -static d_devtotty_t siodevtotty; #define CDEV_MAJOR 28 static struct cdevsw sio_cdevsw = { @@ -348,10 +347,10 @@ static struct cdevsw sio_cdevsw = { /* read */ sioread, /* write */ siowrite, /* ioctl */ sioioctl, - /* stop */ siostop, + /* stop */ nostop, /* reset */ noreset, - /* devtotty */ siodevtotty, - /* poll */ ttpoll, + /* devtotty */ nodevtotty, + /* poll */ ttypoll, /* mmap */ nommap, /* strategy */ nostrategy, /* name */ driver_name, @@ -1210,6 +1209,7 @@ open_top: */ tp->t_oproc = comstart; tp->t_param = comparam; + tp->t_stop = comstop; tp->t_dev = dev; tp->t_termios = mynor & CALLOUT_MASK ? com->it_out : com->it_in; @@ -1336,7 +1336,7 @@ sioclose(dev, flag, mode, p) s = spltty(); (*linesw[tp->t_line].l_close)(tp, flag); disc_optim(tp, &tp->t_termios, com); - siostop(tp, FREAD | FWRITE); + comstop(tp, FREAD | FWRITE); comhardclose(com); ttyclose(tp); siosettimeout(); @@ -2375,7 +2375,7 @@ comstart(tp) } static void -siostop(tp, rw) +comstop(tp, rw) struct tty *tp; int rw; { @@ -2415,22 +2415,6 @@ siostop(tp, rw) comstart(tp); } -static struct tty * -siodevtotty(dev) - dev_t dev; -{ - int mynor; - int unit; - - mynor = minor(dev); - if (mynor & CONTROL_MASK) - return (NULL); - unit = MINOR_TO_UNIT(mynor); - if ((u_int) unit >= NSIOTOT) - return (NULL); - return (dev->si_tty); -} - static int commctl(com, bits, how) struct com_s *com; diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index 7563686..e30b293 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -82,9 +82,9 @@ snpdevtotty (dev) struct cdevsw *cdp; cdp = devsw(dev); - if (cdp == NULL) - return (NULL); - return ((*cdp->d_devtotty)(dev)); + if (cdp && cdp->d_flags & D_TTY) + return (dev->si_tty); + return (NULL); } #define SNP_INPUT_BUF 5 /* This is even too much,the maximal diff --git a/sys/dev/syscons/scvesactl.c b/sys/dev/syscons/scvesactl.c index 21295a4..9749cc2 100644 --- a/sys/dev/syscons/scvesactl.c +++ b/sys/dev/syscons/scvesactl.c @@ -59,7 +59,7 @@ vesa_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) struct tty *tp; int mode; - tp = scdevtotty(dev); + tp = dev->si_tty; if (!tp) return ENXIO; scp = SC_STAT(tp->t_dev); diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 3af6134..6ea829f 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -217,8 +217,8 @@ static struct cdevsw sc_cdevsw = { /* ioctl */ scioctl, /* stop */ nostop, /* reset */ noreset, - /* devtotty */ scdevtotty, - /* poll */ ttpoll, + /* devtotty */ nodevtotty, + /* poll */ ttypoll, /* mmap */ scmmap, /* strategy */ nostrategy, /* name */ "sc", @@ -441,13 +441,6 @@ sc_resume_unit(int unit) return 0; } -struct tty -*scdevtotty(dev_t dev) -{ - - return (dev->si_tty); -} - static int scdevtounit(dev_t dev) { @@ -488,6 +481,7 @@ scopen(dev_t dev, int flag, int mode, struct proc *p) tp = dev->si_tty = ttymalloc(dev->si_tty); tp->t_oproc = (SC_VTY(dev) == SC_MOUSE) ? scmousestart : scstart; tp->t_param = scparam; + tp->t_stop = nostop; tp->t_dev = dev; if (!(tp->t_state & TS_ISOPEN)) { ttychars(tp); diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h index df9fdf3..ac38909 100644 --- a/sys/dev/syscons/syscons.h +++ b/sys/dev/syscons/syscons.h @@ -418,7 +418,6 @@ void sc_clear_screen(scr_stat *scp); void sc_set_cursor_image(scr_stat *scp); int sc_clean_up(scr_stat *scp); void sc_alloc_scr_buffer(scr_stat *scp, int wait, int discard); -struct tty *scdevtotty(dev_t dev); #ifndef SC_NO_SYSMOUSE struct tty *sc_get_mouse_tty(void); #endif /* SC_NO_SYSMOUSE */ |