summaryrefslogtreecommitdiffstats
path: root/sys/dev/digi
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-06-04 21:55:55 +0000
committerphk <phk@FreeBSD.org>2004-06-04 21:55:55 +0000
commit17b52df3d7ba0c2789f07e8d92f72a03d507f1af (patch)
tree1aba351b2574e6180f5f98824ce4d10b1ba035f7 /sys/dev/digi
parent06049d3eaf941ee534b340558daac059b6b18912 (diff)
downloadFreeBSD-src-17b52df3d7ba0c2789f07e8d92f72a03d507f1af.zip
FreeBSD-src-17b52df3d7ba0c2789f07e8d92f72a03d507f1af.tar.gz
Centralize the line discipline optimization determination in a function
called ttyldoptim(). Use this function from all the relevant drivers. I belive no drivers finger linesw[] directly anymore, paving the way for locking and refcounting.
Diffstat (limited to 'sys/dev/digi')
-rw-r--r--sys/dev/digi/digi.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c
index d13e50f..e99e737 100644
--- a/sys/dev/digi/digi.c
+++ b/sys/dev/digi/digi.c
@@ -693,20 +693,6 @@ digimctl(struct digi_p *port, int bits, int how)
return (0);
}
-static void
-digi_disc_optim(struct tty *tp, struct termios *t, struct digi_p *port)
-{
- if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP)) &&
- (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK)) &&
- (!(t->c_iflag & PARMRK) ||
- (t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK)) &&
- !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN)) &&
- linesw[tp->t_line].l_rint == ttyinput)
- tp->t_state |= TS_CAN_BYPASS_L_RINT;
- else
- tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
-}
-
static int
digiopen(dev_t dev, int flag, int mode, struct thread *td)
{
@@ -853,7 +839,7 @@ open_top:
DLOG(DIGIDB_OPEN, (sc->dev, "port %d: l_open error = %d\n",
pnum, error));
- digi_disc_optim(tp, &tp->t_termios, port);
+ ttyldoptim(tp);
if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK)
port->active_out = TRUE;
@@ -901,7 +887,7 @@ digiclose(dev_t dev, int flag, int mode, struct thread *td)
s = spltty();
ttyld_close(tp, flag);
- digi_disc_optim(tp, &tp->t_termios, port);
+ ttyldoptim(tp);
digihardclose(port);
ttyclose(tp);
if (--sc->opencnt == 0)
@@ -1278,7 +1264,7 @@ digiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
error = ttyioctl(dev, cmd, data, flag, td);
if (error == 0 && cmd == TIOCGETA)
((struct termios *)data)->c_iflag |= port->c_iflag;
- digi_disc_optim(tp, &tp->t_termios, port);
+ ttyldoptim(tp);
if (error >= 0 && error != ENOTTY)
return (error);
s = spltty();
OpenPOWER on IntegriCloud