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/pc98 | |
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/pc98')
-rw-r--r-- | sys/pc98/cbus/sio.c | 28 | ||||
-rw-r--r-- | sys/pc98/pc98/sio.c | 28 |
2 files changed, 8 insertions, 48 deletions
diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index e2c652f..12c8243 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -386,8 +386,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; @@ -2069,7 +2067,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(); @@ -2104,7 +2102,7 @@ sioclose(dev, flag, mode, td) #ifdef PC98 com->modem_checking = 0; #endif - disc_optim(tp, &tp->t_termios, com); + com->hotchar = ttyldoptim(tp); comhardclose(com); ttyclose(tp); siosettimeout(); @@ -3022,7 +3020,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(); @@ -3438,7 +3436,7 @@ comparam(tp, t) #endif /* 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); @@ -3898,24 +3896,6 @@ commint(dev_t dev) } #endif -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 */ diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index e2c652f..12c8243 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -386,8 +386,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; @@ -2069,7 +2067,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(); @@ -2104,7 +2102,7 @@ sioclose(dev, flag, mode, td) #ifdef PC98 com->modem_checking = 0; #endif - disc_optim(tp, &tp->t_termios, com); + com->hotchar = ttyldoptim(tp); comhardclose(com); ttyclose(tp); siosettimeout(); @@ -3022,7 +3020,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(); @@ -3438,7 +3436,7 @@ comparam(tp, t) #endif /* 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); @@ -3898,24 +3896,6 @@ commint(dev_t dev) } #endif -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 */ |