diff --git a/sys/dev/cx/if_cx.c b/sys/dev/cx/if_cx.c index b22e84a8328b..e69aa42b3284 100644 --- a/sys/dev/cx/if_cx.c +++ b/sys/dev/cx/if_cx.c @@ -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) { diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 194b01c1620d..c6e72205f9d8 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -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 diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c index d5e413901dd4..06d8d18a4fc2 100644 --- a/sys/dev/digi/digi.c +++ b/sys/dev/digi/digi.c @@ -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: diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index 2a58b71e235b..14b3c96d0649 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -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(); diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c index 926c14d545fe..feff480ebd21 100644 --- a/sys/dev/rp/rp.c +++ b/sys/dev/rp/rp.c @@ -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); diff --git a/sys/dev/sab/sab.c b/sys/dev/sab/sab.c index de8873163ac7..e546e24a4bc1 100644 --- a/sys/dev/sab/sab.c +++ b/sys/dev/sab/sab.c @@ -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; diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index bb1c102675e6..b4f8f0703ca6 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -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: diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 7eb106eddbc6..ce064c4a5f6d 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -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); diff --git a/sys/dev/sx/sx.c b/sys/dev/sx/sx.c index 0f07f9418140..b3e1cf2061ef 100644 --- a/sys/dev/sx/sx.c +++ b/sys/dev/sx/sx.c @@ -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) { diff --git a/sys/dev/uart/uart_tty.c b/sys/dev/uart/uart_tty.c index 94ddb953052b..6867299a1ec3 100644 --- a/sys/dev/uart/uart_tty.c +++ b/sys/dev/uart/uart_tty.c @@ -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; diff --git a/sys/dev/usb/ubser.c b/sys/dev/usb/ubser.c index b3edce89fca4..59ad8d5a6f68 100644 --- a/sys/dev/usb/ubser.c +++ b/sys/dev/usb/ubser.c @@ -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(); diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 0a33937fa39f..e3cf7b6366de 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -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, diff --git a/sys/dev/zs/zs.c b/sys/dev/zs/zs.c index 98f1c7dd60b0..6de28ed13152 100644 --- a/sys/dev/zs/zs.c +++ b/sys/dev/zs/zs.c @@ -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; diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index 68045ab942db..ba1a15f29aff 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -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) { diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index 68045ab942db..ba1a15f29aff 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -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) { diff --git a/sys/sys/param.h b/sys/sys/param.h index bce887454593..9d1d35411c1a 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -55,7 +55,7 @@ * scheme is: <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