Make the remaining serial drivers call ttyioctl() rather than calling

the linedisc directly.
This commit is contained in:
Poul-Henning Kamp 2004-06-04 08:02:37 +00:00
parent d1afdc6644
commit e451f9b758
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130057
16 changed files with 48 additions and 112 deletions

View File

@ -2117,6 +2117,15 @@ static int cx_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct threa
}
if (c->mode == M_ASYNC) {
#if __FreeBSD_version >= 502113
error = ttyioctl (dev, cmd, data, flag, td);
disc_optim (&d->tty, &d->tty.t_termios);
if (error != ENOTTY) {
if (error)
CX_DEBUG2 (d, ("ttioctl: 0x%lx, error %d\n", cmd, error));
return error;
}
#else
#if __FreeBSD_version >= 500000
error = (*linesw[d->tty.t_line].l_ioctl) (&d->tty, cmd, data, flag, td);
#else
@ -2135,6 +2144,7 @@ static int cx_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct threa
CX_DEBUG2 (d, ("ttioctl: 0x%lx, error %d\n", cmd, error));
return error;
}
#endif
}
switch (cmd) {

View File

@ -1611,16 +1611,11 @@ sioioctl(dev, cmd, data, flag, td)
if (lt->c_ospeed != 0)
dt->c_ospeed = tp->t_ospeed;
}
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
if (error != ENOIOCTL)
error = ttyioctl(dev, cmd, data, flag, td);
disc_optim(tp, &tp->t_termios, com);
if (error != ENOTTY)
return (error);
s = spltty();
error = ttioctl(tp, cmd, data, flag);
disc_optim(tp, &tp->t_termios, com);
if (error != ENOIOCTL) {
splx(s);
return (error);
}
switch (cmd) {
case TIOCSBRK:
#if 0

View File

@ -1275,22 +1275,13 @@ digiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
if (lt->c_ospeed != 0)
dt->c_ospeed = tp->t_ospeed;
}
error = linesw[tp->t_line].l_ioctl(tp, cmd, data, flag, td);
error = ttyioctl(dev, cmd, data, flag, td);
if (error == 0 && cmd == TIOCGETA)
((struct termios *)data)->c_iflag |= port->c_iflag;
if (error >= 0 && error != ENOIOCTL)
digi_disc_optim(tp, &tp->t_termios, port);
if (error >= 0 && error != ENOTTY)
return (error);
s = spltty();
error = ttioctl(tp, cmd, data, flag);
if (error == 0 && cmd == TIOCGETA)
((struct termios *)data)->c_iflag |= port->c_iflag;
digi_disc_optim(tp, &tp->t_termios, port);
if (error >= 0 && error != ENOIOCTL) {
splx(s);
return (error);
}
sc->setwin(sc, 0);
switch (cmd) {
case DIGIIO_RING:

View File

@ -1207,12 +1207,9 @@ 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 = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
if (error != ENOIOCTL)
return (error);
error = ttioctl(tp, cmd, data, flag);
error = ttyioctl(dev, cmd, data, flag, td);
disc_optim(tp, &tp->t_termios, rc);
if (error != ENOIOCTL)
if (error != ENOTTY)
return (error);
s = spltty();

View File

@ -1320,21 +1320,14 @@ rpioctl(dev, cmd, data, flag, td)
t = &tp->t_termios;
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
if(error != ENOIOCTL) {
error = ttyioctl(dev, cmd, data, flag, td);
rp_disc_optim(tp, &tp->t_termios);
if(error != ENOTTY)
return(error);
}
oldspl = spltty();
flags = rp->rp_channel.TxControl[3];
error = ttioctl(tp, cmd, data, flag);
flags = rp->rp_channel.TxControl[3];
rp_disc_optim(tp, &tp->t_termios);
if(error != ENOIOCTL) {
splx(oldspl);
return(error);
}
switch(cmd) {
case TIOCSBRK:
sSendBreak(&rp->rp_channel);

View File

@ -731,12 +731,8 @@ sabttyioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td)
sc = dev->si_drv1;
tp = dev->si_tty;
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flags, td);
if (error != ENOIOCTL)
return (error);
error = ttioctl(tp, cmd, data, flags);
if (error != ENOIOCTL)
error = ttyioctl(dev, cmd, data, flags, td);
if (error != ENOTTY)
return (error);
error = 0;

View File

@ -1016,19 +1016,13 @@ siioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
si_write_enable(pp, 0);
}
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
if (error != ENOIOCTL)
error = ttyioctl(dev, cmd, data, flag, td);
si_disc_optim(tp, &tp->t_termios, pp);
if (error != ENOTTY)
goto out;
oldspl = spltty();
error = ttioctl(tp, cmd, data, flag);
si_disc_optim(tp, &tp->t_termios, pp);
if (error != ENOIOCTL) {
splx(oldspl);
goto out;
}
error = 0;
switch (cmd) {
case TIOCSBRK:

View File

@ -2048,16 +2048,11 @@ sioioctl(dev, cmd, data, flag, td)
if (lt->c_ospeed != 0)
dt->c_ospeed = tp->t_ospeed;
}
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
if (error != ENOIOCTL)
error = ttyioctl(dev, cmd, data, flag, td);
disc_optim(tp, &tp->t_termios, com);
if (error != ENOTTY)
return (error);
s = spltty();
error = ttioctl(tp, cmd, data, flag);
disc_optim(tp, &tp->t_termios, com);
if (error != ENOIOCTL) {
splx(s);
return (error);
}
switch (cmd) {
case TIOCSBRK:
sio_setreg(com, com_cfcr, com->cfcr_image |= CFCR_SBREAK);

View File

@ -804,18 +804,13 @@ sxioctl(
sx_write_enable(pp, 0);
}
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
if (error != ENOIOCTL)
error = ttyioctl(dev, cmd, data, flag, p);
sx_disc_optim(tp, &tp->t_termios, pp);
if (error != ENOTTY)
goto out;
oldspl = spltty();
error = ttioctl(tp, cmd, data, flag);
sx_disc_optim(tp, &tp->t_termios, pp);
if (error != ENOIOCTL) {
splx(oldspl);
goto out;
}
sc = PP2SC(pp); /* Need this to do I/O to the card. */
error = 0;
switch (cmd) {

View File

@ -497,11 +497,8 @@ uart_tty_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags,
return (ENODEV);
tp = dev->si_tty;
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flags, td);
if (error != ENOIOCTL)
return (error);
error = ttioctl(tp, cmd, data, flags);
if (error != ENOIOCTL)
error = ttyioctl(dev, cmd, data, flags, td);
if (error != ENOTTY)
return (error);
error = 0;

View File

@ -971,18 +971,12 @@ ubser_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
if (sc->sc_dying)
return (EIO);
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
if (error >= 0) {
error = ttyioctl(dev, cmd, data, flag, p);
if (error != ENOTTY) {
DPRINTF(("ubser_ioctl: l_ioctl: error = %d\n", error));
return (error);
}
error = ttioctl(tp, cmd, data, flag);
if (error >= 0) {
DPRINTF(("ubser_ioctl: ttioctl: error = %d\n", error));
return (error);
}
error = 0;
s = spltty();

View File

@ -563,22 +563,15 @@ ucomioctl(dev_t dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
data = (caddr_t)&term;
#endif
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
if (error != ENOIOCTL) {
error = ttyioctl(dev, cmd, data, flag, p);
disc_optim(tp, &tp->t_termios, sc);
if (error != ENOTTY) {
DPRINTF(("ucomioctl: l_ioctl: error = %d\n", error));
return (error);
}
s = spltty();
error = ttioctl(tp, cmd, data, flag);
disc_optim(tp, &tp->t_termios, sc);
if (error != ENOIOCTL) {
splx(s);
DPRINTF(("ucomioctl: ttioctl: error = %d\n", error));
return (error);
}
if (sc->sc_callback->ucom_ioctl != NULL) {
error = sc->sc_callback->ucom_ioctl(sc->sc_parent,
sc->sc_portno,

View File

@ -528,12 +528,8 @@ zsttyioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td)
sc = dev->si_drv1;
tp = dev->si_tty;
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flags, td);
if (error != ENOIOCTL)
return (error);
error = ttioctl(tp, cmd, data, flags);
if (error != ENOIOCTL)
error = ttyioctl(dev, cmd, data, flags, td);
if (error != ENOTTY)
return (error);
error = 0;

View File

@ -3021,16 +3021,11 @@ sioioctl(dev, cmd, data, flag, td)
if (lt->c_ospeed != 0)
dt->c_ospeed = tp->t_ospeed;
}
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
if (error != ENOIOCTL)
error = ttyioctl(dev, cmd, data, flag, td);
disc_optim(tp, &tp->t_termios, com);
if (error != ENOTTY)
return (error);
s = spltty();
error = ttioctl(tp, cmd, data, flag);
disc_optim(tp, &tp->t_termios, com);
if (error != ENOIOCTL) {
splx(s);
return (error);
}
#ifdef PC98
if (IS_8251(com->pc98_if_type)) {
switch (cmd) {

View File

@ -3021,16 +3021,11 @@ sioioctl(dev, cmd, data, flag, td)
if (lt->c_ospeed != 0)
dt->c_ospeed = tp->t_ospeed;
}
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
if (error != ENOIOCTL)
error = ttyioctl(dev, cmd, data, flag, td);
disc_optim(tp, &tp->t_termios, com);
if (error != ENOTTY)
return (error);
s = spltty();
error = ttioctl(tp, cmd, data, flag);
disc_optim(tp, &tp->t_termios, com);
if (error != ENOIOCTL) {
splx(s);
return (error);
}
#ifdef PC98
if (IS_8251(com->pc98_if_type)) {
switch (cmd) {

View File

@ -55,7 +55,7 @@
* scheme is: <major><two digit minor><0 if release branch, otherwise 1>xx
*/
#undef __FreeBSD_version
#define __FreeBSD_version 502112 /* Master, propagated to newvers */
#define __FreeBSD_version 502113 /* Master, propagated to newvers */
#ifndef LOCORE
#include <sys/types.h>