From 3683e698d2b43b057fd00f831207c4322511e44d Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 11 Jul 2004 15:18:39 +0000 Subject: Introduce ttygone() which indicates that the hardware is detached. Move dtrwait logic to the generic TTY level. --- sys/dev/si/si.c | 44 ++++---------------------------------------- sys/dev/si/si.h | 2 -- 2 files changed, 4 insertions(+), 42 deletions(-) (limited to 'sys/dev/si') diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index ffe26cb..7a64b7b 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -102,7 +102,6 @@ static void si_start(struct tty *); static void si_stop(struct tty *, int); static timeout_t si_lstart; static void sihardclose(struct si_port *pp); -static void sidtrwakeup(void *chan); #ifdef SI_DEBUG static char *si_mctl2str(enum si_mctl cmd); @@ -543,7 +542,6 @@ try_next: pp->sp_tty = ttymalloc(NULL); pp->sp_pend = IDLE_CLOSE; pp->sp_state = 0; /* internal flag */ - pp->sp_dtr_wait = 3 * hz; pp->sp_iin.c_iflag = TTYDEF_IFLAG; pp->sp_iin.c_oflag = TTYDEF_OFLAG; pp->sp_iin.c_cflag = TTYDEF_CFLAG; @@ -652,11 +650,9 @@ siopen(struct cdev *dev, int flag, int mode, struct thread *td) error = 0; open_top: - while (pp->sp_state & SS_DTR_OFF) { - error = tsleep(&pp->sp_dtr_wait, TTIPRI|PCATCH, "sidtr", 0); - if (error != 0) - goto out; - } + error = ttydtrwaitsleep(tp); + if (error != 0) + goto out; if (tp->t_state & TS_ISOPEN) { /* @@ -837,11 +833,7 @@ sihardclose(struct si_port *pp) (void) si_modem(pp, BIC, TIOCM_DTR|TIOCM_RTS); (void) si_command(pp, FCLOSE, SI_NOWAIT); - if (pp->sp_dtr_wait != 0) { - timeout(sidtrwakeup, pp, pp->sp_dtr_wait); - pp->sp_state |= SS_DTR_OFF; - } - + ttydtrwaitstart(tp); } pp->sp_active_out = FALSE; wakeup(&pp->sp_active_out); @@ -850,25 +842,6 @@ sihardclose(struct si_port *pp) splx(oldspl); } - -/* - * called at splsoftclock()... - */ -static void -sidtrwakeup(void *chan) -{ - struct si_port *pp; - int oldspl; - - oldspl = spltty(); - - pp = (struct si_port *)chan; - pp->sp_state &= ~SS_DTR_OFF; - wakeup(&pp->sp_dtr_wait); - - splx(oldspl); -} - static int siwrite(struct cdev *dev, struct uio *uio, int flag) { @@ -1056,15 +1029,6 @@ siioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) case TIOCMGET: *(int *)data = si_modem(pp, GET, 0); break; - case TIOCMSDTRWAIT: - /* must be root since the wait applies to following logins */ - error = suser(td); - if (error == 0) - pp->sp_dtr_wait = *(int *)data * hz / 100; - break; - case TIOCMGDTRWAIT: - *(int *)data = pp->sp_dtr_wait * 100 / hz; - break; default: error = ENOTTY; } diff --git a/sys/dev/si/si.h b/sys/dev/si/si.h index 3222e2e..b9576b2 100644 --- a/sys/dev/si/si.h +++ b/sys/dev/si/si.h @@ -331,7 +331,6 @@ struct si_port { int sp_last_hi_ip; /* cached DCD */ int sp_state; int sp_active_out; /* callout is open */ - int sp_dtr_wait; /* DTR holddown in hz */ int sp_delta_overflows; u_int sp_wopeners; /* # procs waiting DCD */ /* Initial state. */ @@ -362,7 +361,6 @@ struct si_port { /* 0x0800 -- */ #define SS_WAITWRITE 0x1000 #define SS_BLOCKWRITE 0x2000 -#define SS_DTR_OFF 0x4000 /* DTR held off */ /* * Command post flags -- cgit v1.1