summaryrefslogtreecommitdiffstats
path: root/sys/dev/rc/rc.c
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/rc/rc.c
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/rc/rc.c')
-rw-r--r--sys/dev/rc/rc.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c
index 13d00ff..1135faf 100644
--- a/sys/dev/rc/rc.c
+++ b/sys/dev/rc/rc.c
@@ -140,7 +140,6 @@ static void rc_reinit(struct rc_softc *);
static void printrcflags();
#endif
static void rc_dtrwakeup(void *);
-static void disc_optim(struct tty *tp, struct termios *t, struct rc_chans *);
static void rc_wait0(struct rc_softc *sc, int chan, int line);
static d_open_t rcopen;
@@ -932,7 +931,7 @@ again:
goto again;
}
error = ttyld_open(tp, dev);
- disc_optim(tp, &tp->t_termios, rc);
+ rc->rc_hotchar = ttyldoptim(tp);
if ((tp->t_state & TS_ISOPEN) && CALLOUT(dev))
rc->rc_flags |= RC_ACTOUT;
out:
@@ -961,7 +960,7 @@ rcclose(dev_t dev, int flag, int mode, d_thread_t *td)
#endif
s = spltty();
ttyld_close(tp, flag);
- disc_optim(tp, &tp->t_termios, rc);
+ rc->rc_hotchar = ttyldoptim(tp);
rc_hardclose(rc);
ttyclose(tp);
splx(s);
@@ -1151,7 +1150,7 @@ rc_param(struct tty *tp, struct termios *ts)
CCRCMD(sc, rc->rc_chan, CCR_CORCHG1 | CCR_CORCHG2 | CCR_CORCHG3);
- disc_optim(tp, ts, rc);
+ rc->rc_hotchar = ttyldoptim(tp);
/* modem ctl */
val = cflag & CLOCAL ? 0 : MCOR1_CDzd;
@@ -1208,7 +1207,7 @@ rcioctl(dev_t dev, u_long cmd, caddr_t data, int flag, d_thread_t *td)
rc = DEV_TO_RC(dev);
tp = &rc->rc_tp;
error = ttyioctl(dev, cmd, data, flag, td);
- disc_optim(tp, &tp->t_termios, rc);
+ rc->rc_hotchar = ttyldoptim(tp);
if (error != ENOTTY)
return (error);
s = spltty();
@@ -1544,22 +1543,6 @@ rc_discard_output(struct rc_chans *rc)
}
static void
-disc_optim(struct tty *tp, struct termios *t, struct rc_chans *rc)
-{
-
- if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP | IXON))
- && (!(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;
- rc->rc_hotchar = linesw[tp->t_line].l_hotchar;
-}
-
-static void
rc_wait0(struct rc_softc *sc, int chan, int line)
{
int rcnt;
OpenPOWER on IntegriCloud