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/dev/si/si.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) (limited to 'sys/dev/si') 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) { -- cgit v1.1