From a2c68c62dba7acc1de5dd6a6141484d9c12844fe Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 25 Sep 1999 16:21:39 +0000 Subject: 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 --- sys/gnu/i386/isa/dgb.c | 31 ++++++------------------------- sys/gnu/i386/isa/dgm.c | 31 ++++++------------------------- 2 files changed, 12 insertions(+), 50 deletions(-) (limited to 'sys/gnu/i386') diff --git a/sys/gnu/i386/isa/dgb.c b/sys/gnu/i386/isa/dgb.c index 60008ab..0f24e8c 100644 --- a/sys/gnu/i386/isa/dgb.c +++ b/sys/gnu/i386/isa/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/gnu/i386/isa/dgm.c b/sys/gnu/i386/isa/dgm.c index 5deb61d..ecf6827 100644 --- a/sys/gnu/i386/isa/dgm.c +++ b/sys/gnu/i386/isa/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; -- cgit v1.1