summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/uart/uart_tty.c14
-rw-r--r--sys/dev/zs/zs.c9
2 files changed, 11 insertions, 12 deletions
diff --git a/sys/dev/uart/uart_tty.c b/sys/dev/uart/uart_tty.c
index 45de134..1a617d3 100644
--- a/sys/dev/uart/uart_tty.c
+++ b/sys/dev/uart/uart_tty.c
@@ -150,8 +150,7 @@ uart_tty_oproc(struct tty *tp)
{
struct uart_softc *sc;
- KASSERT(tp->t_dev != NULL, ("foo"));
- sc = tp->t_dev->si_drv1;
+ sc = tp->t_sc;
if (sc == NULL || sc->sc_leaving)
return;
@@ -194,8 +193,7 @@ uart_tty_param(struct tty *tp, struct termios *t)
struct uart_softc *sc;
int databits, parity, stopbits;
- KASSERT(tp->t_dev != NULL, ("foo"));
- sc = tp->t_dev->si_drv1;
+ sc = tp->t_sc;
if (sc == NULL || sc->sc_leaving)
return (ENODEV);
if (t->c_ispeed != t->c_ospeed && t->c_ospeed != 0)
@@ -245,7 +243,7 @@ uart_tty_modem(struct tty *tp, int biton, int bitoff)
{
struct uart_softc *sc;
- sc = tp->t_dev->si_drv1;
+ sc = tp->t_sc;
if (biton != 0 || bitoff != 0)
UART_SETSIG(sc, SER_DELTA(bitoff|biton) | biton);
return (sc->sc_hwsig);
@@ -256,7 +254,7 @@ uart_tty_break(struct tty *tp, int state)
{
struct uart_softc *sc;
- sc = tp->t_dev->si_drv1;
+ sc = tp->t_sc;
UART_IOCTL(sc, UART_IOCTL_BREAK, state);
}
@@ -265,8 +263,7 @@ uart_tty_stop(struct tty *tp, int rw)
{
struct uart_softc *sc;
- KASSERT(tp->t_dev != NULL, ("foo"));
- sc = tp->t_dev->si_drv1;
+ sc = tp->t_sc;
if (sc == NULL || sc->sc_leaving)
return;
if (rw & FWRITE) {
@@ -342,6 +339,7 @@ uart_tty_attach(struct uart_softc *sc)
tp = ttyalloc();
sc->sc_u.u_tty.tp = tp;
+ tp->t_sc = sc;
sc->sc_u.u_tty.si[0] = make_dev(&uart_cdevsw,
device_get_unit(sc->sc_dev), UID_ROOT, GID_WHEEL, 0600, "ttyu%r",
diff --git a/sys/dev/zs/zs.c b/sys/dev/zs/zs.c
index ab3eb33..b79060b 100644
--- a/sys/dev/zs/zs.c
+++ b/sys/dev/zs/zs.c
@@ -263,6 +263,7 @@ zstty_attach(device_t dev)
sc->sc_oget = sc->sc_obuf;
tp = ttyalloc();
+ tp->t_sc = sc;
sc->sc_si = make_dev(&zstty_cdevsw, device_get_unit(dev),
UID_ROOT, GID_WHEEL, 0600, "%s", device_get_desc(dev));
sc->sc_si->si_drv1 = sc;
@@ -525,7 +526,7 @@ zsttystart(struct tty *tp)
struct zstty_softc *sc;
uint8_t c;
- sc = tp->t_dev->si_drv1;
+ sc = tp->t_sc;
if ((tp->t_state & TS_TBLOCK) != 0)
/* XXX clear RTS */;
@@ -582,7 +583,7 @@ zsttystop(struct tty *tp, int flag)
{
struct zstty_softc *sc;
- sc = tp->t_dev->si_drv1;
+ sc = tp->t_sc;
if ((flag & FREAD) != 0) {
/* XXX stop reading, anything to do? */;
@@ -602,7 +603,7 @@ zsttyparam(struct tty *tp, struct termios *t)
{
struct zstty_softc *sc;
- sc = tp->t_dev->si_drv1;
+ sc = tp->t_sc;
return (zstty_param(sc, tp, t));
}
@@ -612,7 +613,7 @@ zsttybreak(struct tty *tp, int brk)
{
struct zstty_softc *sc;
- sc = tp->t_dev->si_drv1;
+ sc = tp->t_sc;
if (brk)
ZS_WRITE_REG(sc, 5, ZS_READ_REG(sc, 5) | ZSWR5_BREAK);
OpenPOWER on IntegriCloud