diff options
author | phk <phk@FreeBSD.org> | 2004-06-04 21:55:55 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-06-04 21:55:55 +0000 |
commit | 17b52df3d7ba0c2789f07e8d92f72a03d507f1af (patch) | |
tree | 1aba351b2574e6180f5f98824ce4d10b1ba035f7 /sys/dev/sio | |
parent | 06049d3eaf941ee534b340558daac059b6b18912 (diff) | |
download | FreeBSD-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/sio')
-rw-r--r-- | sys/dev/sio/sio.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index f384e31..a63625f 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -300,8 +300,6 @@ static int siosetwater(struct com_s *com, speed_t speed); static void comstart(struct tty *tp); static void comstop(struct tty *tp, int rw); static timeout_t comwakeup; -static void disc_optim(struct tty *tp, struct termios *t, - struct com_s *com); char sio_driver_name[] = "sio"; static struct mtx sio_lock; @@ -1352,7 +1350,7 @@ open_top: goto open_top; } error = ttyld_open(tp, dev); - disc_optim(tp, &tp->t_termios, com); + com->hotchar = ttyldoptim(tp); if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK) com->active_out = TRUE; siosettimeout(); @@ -1384,7 +1382,7 @@ sioclose(dev, flag, mode, td) tp = com->tp; s = spltty(); ttyld_close(tp, flag); - disc_optim(tp, &tp->t_termios, com); + com->hotchar = ttyldoptim(tp); comhardclose(com); ttyclose(tp); siosettimeout(); @@ -2049,7 +2047,7 @@ sioioctl(dev, cmd, data, flag, td) dt->c_ospeed = tp->t_ospeed; } error = ttyioctl(dev, cmd, data, flag, td); - disc_optim(tp, &tp->t_termios, com); + com->hotchar = ttyldoptim(tp); if (error != ENOTTY) return (error); s = spltty(); @@ -2333,7 +2331,7 @@ comparam(tp, t) sio_setreg(com, com_cfcr, com->cfcr_image = cfcr); /* XXX shouldn't call functions while intrs are disabled. */ - disc_optim(tp, t, com); + com->hotchar = ttyldoptim(tp); mtx_unlock_spin(&sio_lock); splx(s); @@ -2695,24 +2693,6 @@ comwakeup(chan) } } -static void -disc_optim(tp, t, com) - struct tty *tp; - struct termios *t; - struct com_s *com; -{ - 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; - com->hotchar = linesw[tp->t_line].l_hotchar; -} - /* * Following are all routines needed for SIO to act as console */ |