summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-07-02 17:27:02 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-07-02 17:27:02 +0000
commit3e0af5ec85e0fe2f9cb51541466d2567ea534a8f (patch)
tree98ea4006ae16bfe6a1b3730074d23b083948b395 /sys/arch
parent4d2486b3dbf3e9ae0c6d38b616a80feed0b5e05a (diff)
Move common code for waking up writers on a tty into a function.
ok deraadt matthew millert
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/alpha/promcons.c10
-rw-r--r--sys/arch/alpha/tc/scc.c18
-rw-r--r--sys/arch/aviion/dev/dart.c14
-rw-r--r--sys/arch/hp300/dev/apci.c14
-rw-r--r--sys/arch/hp300/dev/dca.c14
-rw-r--r--sys/arch/hp300/dev/dcm.c10
-rw-r--r--sys/arch/hppa/dev/pdc.c10
-rw-r--r--sys/arch/hppa64/dev/pdc.c10
-rw-r--r--sys/arch/luna88k/dev/siotty.c10
-rw-r--r--sys/arch/mac68k/dev/z8530tty.c10
-rw-r--r--sys/arch/macppc/dev/z8530tty.c14
-rw-r--r--sys/arch/mvme68k/dev/dart.c14
-rw-r--r--sys/arch/mvme68k/dev/zs.c18
-rw-r--r--sys/arch/mvme88k/dev/dart.c14
-rw-r--r--sys/arch/sh/dev/scif.c14
-rw-r--r--sys/arch/sparc/dev/magma.c11
-rw-r--r--sys/arch/sparc/dev/spif.c10
-rw-r--r--sys/arch/sparc/dev/z8530tty.c14
-rw-r--r--sys/arch/sparc64/dev/sab.c10
-rw-r--r--sys/arch/sparc64/dev/sbbc.c10
-rw-r--r--sys/arch/sparc64/dev/vcctty.c10
-rw-r--r--sys/arch/sparc64/dev/vcons.c10
-rw-r--r--sys/arch/sparc64/dev/z8530tty.c14
-rw-r--r--sys/arch/vax/qbus/dhu.c10
-rw-r--r--sys/arch/vax/qbus/dl.c19
-rw-r--r--sys/arch/vax/vxt/qsc.c14
26 files changed, 78 insertions, 248 deletions
diff --git a/sys/arch/alpha/alpha/promcons.c b/sys/arch/alpha/alpha/promcons.c
index 1705e3085dc..0dda2c26fbe 100644
--- a/sys/arch/alpha/alpha/promcons.c
+++ b/sys/arch/alpha/alpha/promcons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: promcons.c,v 1.15 2010/06/28 14:13:25 deraadt Exp $ */
+/* $OpenBSD: promcons.c,v 1.16 2010/07/02 17:27:01 nicm Exp $ */
/* $NetBSD: promcons.c,v 1.5 1996/11/13 22:20:55 cgd Exp $ */
/*
@@ -184,13 +184,7 @@ promstart(tp)
s = spltty();
if (tp->t_state & (TS_TTSTOP | TS_BUSY))
goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0)
promcnputc(tp->t_dev, getc(&tp->t_outq));
diff --git a/sys/arch/alpha/tc/scc.c b/sys/arch/alpha/tc/scc.c
index cb2dcd3c0b5..d25901ee6b2 100644
--- a/sys/arch/alpha/tc/scc.c
+++ b/sys/arch/alpha/tc/scc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scc.c,v 1.28 2010/06/28 14:13:26 deraadt Exp $ */
+/* $OpenBSD: scc.c,v 1.29 2010/07/02 17:27:01 nicm Exp $ */
/* $NetBSD: scc.c,v 1.58 2002/03/17 19:40:27 atatat Exp $ */
/*
@@ -923,13 +923,7 @@ sccstart(tp)
s = spltty();
if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
if (tp->t_outq.c_cc == 0)
goto out;
/* handle console specially */
@@ -942,13 +936,7 @@ sccstart(tp)
* After we flush the output queue we may need to wake
* up the process that made the output.
*/
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
goto out;
}
cc = ndqb(&tp->t_outq, 0);
diff --git a/sys/arch/aviion/dev/dart.c b/sys/arch/aviion/dev/dart.c
index f2be4e0c7d3..0e3bb9dceae 100644
--- a/sys/arch/aviion/dev/dart.c
+++ b/sys/arch/aviion/dev/dart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dart.c,v 1.10 2010/06/28 14:13:27 deraadt Exp $ */
+/* $OpenBSD: dart.c,v 1.11 2010/07/02 17:27:01 nicm Exp $ */
/*
* Mach Operating System
@@ -262,15 +262,9 @@ dartstart(struct tty *tp)
if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))
goto bail;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- if (tp->t_outq.c_cc == 0)
- goto bail;
- }
+ ttwakeupwr(tp);
+ if (tp->t_outq.c_cc == 0)
+ goto bail;
tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0) {
diff --git a/sys/arch/hp300/dev/apci.c b/sys/arch/hp300/dev/apci.c
index 4e5b9ad65ba..6bc333b4f4d 100644
--- a/sys/arch/hp300/dev/apci.c
+++ b/sys/arch/hp300/dev/apci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apci.c,v 1.40 2010/06/30 18:10:47 miod Exp $ */
+/* $OpenBSD: apci.c,v 1.41 2010/07/02 17:27:01 nicm Exp $ */
/* $NetBSD: apci.c,v 1.9 2000/11/02 00:35:05 eeh Exp $ */
/*-
@@ -762,15 +762,9 @@ apcistart(tp)
if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- if (tp->t_outq.c_cc == 0)
- goto out;
- }
+ ttwakeupwr(tp);
+ if (tp->t_outq.c_cc == 0)
+ goto out;
if (apci->ap_lsr & LSR_TXRDY) {
tp->t_state |= TS_BUSY;
if (sc->sc_flags & APCI_HASFIFO) {
diff --git a/sys/arch/hp300/dev/dca.c b/sys/arch/hp300/dev/dca.c
index 2083b880b70..ef2c0a306da 100644
--- a/sys/arch/hp300/dev/dca.c
+++ b/sys/arch/hp300/dev/dca.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dca.c,v 1.41 2010/06/30 18:10:47 miod Exp $ */
+/* $OpenBSD: dca.c,v 1.42 2010/07/02 17:27:01 nicm Exp $ */
/* $NetBSD: dca.c,v 1.35 1997/05/05 20:58:18 thorpej Exp $ */
/*
@@ -861,15 +861,9 @@ dcastart(tp)
if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- if (tp->t_outq.c_cc == 0)
- goto out;
- }
+ ttwakeupwr(tp);
+ if (tp->t_outq.c_cc == 0)
+ goto out;
if (dca->dca_lsr & LSR_TXRDY) {
tp->t_state |= TS_BUSY;
if (sc->sc_flags & DCA_HASFIFO) {
diff --git a/sys/arch/hp300/dev/dcm.c b/sys/arch/hp300/dev/dcm.c
index 9691f312a2f..3e329fc8ac5 100644
--- a/sys/arch/hp300/dev/dcm.c
+++ b/sys/arch/hp300/dev/dcm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dcm.c,v 1.34 2010/06/28 14:13:27 deraadt Exp $ */
+/* $OpenBSD: dcm.c,v 1.35 2010/07/02 17:27:01 nicm Exp $ */
/* $NetBSD: dcm.c,v 1.41 1997/05/05 20:59:16 thorpej Exp $ */
/*
@@ -1171,13 +1171,7 @@ dcmstart(tp)
#endif
if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state&TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
if (tp->t_outq.c_cc == 0) {
#ifdef DCMSTATS
dsp->xempty++;
diff --git a/sys/arch/hppa/dev/pdc.c b/sys/arch/hppa/dev/pdc.c
index 5a411fa8d89..a2db4651c87 100644
--- a/sys/arch/hppa/dev/pdc.c
+++ b/sys/arch/hppa/dev/pdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pdc.c,v 1.37 2010/06/28 14:13:27 deraadt Exp $ */
+/* $OpenBSD: pdc.c,v 1.38 2010/07/02 17:27:01 nicm Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
@@ -338,13 +338,7 @@ pdcstart(tp)
splx(s);
return;
}
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0)
pdccnputc(tp->t_dev, getc(&tp->t_outq));
diff --git a/sys/arch/hppa64/dev/pdc.c b/sys/arch/hppa64/dev/pdc.c
index 6716b95c027..e8608234ee0 100644
--- a/sys/arch/hppa64/dev/pdc.c
+++ b/sys/arch/hppa64/dev/pdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pdc.c,v 1.9 2010/06/28 14:13:28 deraadt Exp $ */
+/* $OpenBSD: pdc.c,v 1.10 2010/07/02 17:27:01 nicm Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -328,13 +328,7 @@ pdcstart(tp)
splx(s);
return;
}
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0)
pdccnputc(tp->t_dev, getc(&tp->t_outq));
diff --git a/sys/arch/luna88k/dev/siotty.c b/sys/arch/luna88k/dev/siotty.c
index 34665475dd5..b6239035ba1 100644
--- a/sys/arch/luna88k/dev/siotty.c
+++ b/sys/arch/luna88k/dev/siotty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siotty.c,v 1.13 2010/06/28 14:13:28 deraadt Exp $ */
+/* $OpenBSD: siotty.c,v 1.14 2010/07/02 17:27:01 nicm Exp $ */
/* $NetBSD: siotty.c,v 1.9 2002/03/17 19:40:43 atatat Exp $ */
/*-
@@ -198,13 +198,7 @@ siostart(tp)
s = spltty();
if (tp->t_state & (TS_BUSY|TS_TIMEOUT|TS_TTSTOP))
goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
if (tp->t_outq.c_cc == 0)
goto out;
diff --git a/sys/arch/mac68k/dev/z8530tty.c b/sys/arch/mac68k/dev/z8530tty.c
index 56a6ac66254..6f856bbbb5b 100644
--- a/sys/arch/mac68k/dev/z8530tty.c
+++ b/sys/arch/mac68k/dev/z8530tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: z8530tty.c,v 1.23 2010/06/28 14:13:28 deraadt Exp $ */
+/* $OpenBSD: z8530tty.c,v 1.24 2010/07/02 17:27:01 nicm Exp $ */
/* $NetBSD: z8530tty.c,v 1.14 1996/12/17 20:42:43 gwr Exp $ */
/*
@@ -639,13 +639,7 @@ zsstart(tp)
* If there are sleepers, and output has drained below low
* water mark, awaken.
*/
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
nch = ndqb(&tp->t_outq, 0); /* XXX */
(void) splzs();
diff --git a/sys/arch/macppc/dev/z8530tty.c b/sys/arch/macppc/dev/z8530tty.c
index 2bbaff08527..b0b6e6e66e5 100644
--- a/sys/arch/macppc/dev/z8530tty.c
+++ b/sys/arch/macppc/dev/z8530tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: z8530tty.c,v 1.13 2010/06/28 14:13:29 deraadt Exp $ */
+/* $OpenBSD: z8530tty.c,v 1.14 2010/07/02 17:27:01 nicm Exp $ */
/* $NetBSD: z8530tty.c,v 1.13 1996/10/16 20:42:14 gwr Exp $ */
/*-
@@ -781,15 +781,9 @@ zsstart(struct tty *tp)
if (zst->zst_tx_stopped)
goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (ISSET(tp->t_state, TS_ASLEEP)) {
- CLR(tp->t_state, TS_ASLEEP);
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- if (tp->t_outq.c_cc == 0)
- goto out;
- }
+ ttwakeupwr(tp);
+ if (tp->t_outq.c_cc == 0)
+ goto out;
/* Grab the first contiguous region of buffer space. */
{
diff --git a/sys/arch/mvme68k/dev/dart.c b/sys/arch/mvme68k/dev/dart.c
index 9c2abb5a137..d1e30fcf547 100644
--- a/sys/arch/mvme68k/dev/dart.c
+++ b/sys/arch/mvme68k/dev/dart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dart.c,v 1.7 2010/06/28 14:13:29 deraadt Exp $ */
+/* $OpenBSD: dart.c,v 1.8 2010/07/02 17:27:01 nicm Exp $ */
/*
* Mach Operating System
@@ -277,15 +277,9 @@ dartstart(struct tty *tp)
if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))
goto bail;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- if (tp->t_outq.c_cc == 0)
- goto bail;
- }
+ ttwakeupwr(tp);
+ if (tp->t_outq.c_cc == 0)
+ goto bail;
tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0) {
diff --git a/sys/arch/mvme68k/dev/zs.c b/sys/arch/mvme68k/dev/zs.c
index 801dbe43a76..71eb8708113 100644
--- a/sys/arch/mvme68k/dev/zs.c
+++ b/sys/arch/mvme68k/dev/zs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zs.c,v 1.33 2010/06/28 14:13:29 deraadt Exp $ */
+/* $OpenBSD: zs.c,v 1.34 2010/07/02 17:27:01 nicm Exp $ */
/*
* Copyright (c) 2000 Steve Murphree, Jr.
@@ -557,13 +557,7 @@ zsstop(tp, flag)
tp->t_state &= ~TS_BUSY;
spltty();
ndflush(&tp->t_outq, n);
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t) & tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
}
splx(s);
return (0);
@@ -905,13 +899,7 @@ zs_softint(arg)
&& (tp->t_state & TS_BUSY) != 0) {
tp->t_state &= ~(TS_BUSY | TS_FLUSH);
ndflush(&tp->t_outq, zp->sent_count);
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t) & tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
if (tp->t_line != 0)
(*linesw[tp->t_line].l_start) (tp);
else
diff --git a/sys/arch/mvme88k/dev/dart.c b/sys/arch/mvme88k/dev/dart.c
index 689209f8c73..d92e4402204 100644
--- a/sys/arch/mvme88k/dev/dart.c
+++ b/sys/arch/mvme88k/dev/dart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dart.c,v 1.56 2010/06/28 14:13:29 deraadt Exp $ */
+/* $OpenBSD: dart.c,v 1.57 2010/07/02 17:27:01 nicm Exp $ */
/*
* Mach Operating System
@@ -306,15 +306,9 @@ dartstart(struct tty *tp)
if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))
goto bail;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- if (tp->t_outq.c_cc == 0)
- goto bail;
- }
+ ttwakeupwr(tp);
+ if (tp->t_outq.c_cc == 0)
+ goto bail;
tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0) {
diff --git a/sys/arch/sh/dev/scif.c b/sys/arch/sh/dev/scif.c
index 2163eda9af5..7e832f7678c 100644
--- a/sys/arch/sh/dev/scif.c
+++ b/sys/arch/sh/dev/scif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scif.c,v 1.13 2010/06/28 14:13:30 deraadt Exp $ */
+/* $OpenBSD: scif.c,v 1.14 2010/07/02 17:27:01 nicm Exp $ */
/* $NetBSD: scif.c,v 1.47 2006/07/23 22:06:06 ad Exp $ */
/*-
@@ -485,15 +485,9 @@ scifstart(struct tty *tp)
if (sc->sc_tx_stopped)
goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (ISSET(tp->t_state, TS_ASLEEP)) {
- CLR(tp->t_state, TS_ASLEEP);
- wakeup(&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- if (tp->t_outq.c_cc == 0)
- goto out;
- }
+ ttwakeupwr(tp);
+ if (tp->t_outq.c_cc == 0)
+ goto out;
/* Grab the first contiguous region of buffer space. */
{
diff --git a/sys/arch/sparc/dev/magma.c b/sys/arch/sparc/dev/magma.c
index 3209d16bb23..50be93a3f9b 100644
--- a/sys/arch/sparc/dev/magma.c
+++ b/sys/arch/sparc/dev/magma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: magma.c,v 1.26 2010/06/28 14:13:30 deraadt Exp $ */
+/* $OpenBSD: magma.c,v 1.27 2010/07/02 17:27:01 nicm Exp $ */
/*-
* Copyright (c) 1998 Iain Hibbert
@@ -1201,14 +1201,7 @@ mtty_start(tp)
* If we are sleeping and output has drained below
* low water mark, awaken.
*/
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (ISSET(tp->t_state, TS_ASLEEP)) {
- CLR(tp->t_state, TS_ASLEEP);
- wakeup(&tp->t_outq);
- }
-
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
/*
* If there is something to send, start transmitting.
diff --git a/sys/arch/sparc/dev/spif.c b/sys/arch/sparc/dev/spif.c
index 03fb662aab9..d1324afd83f 100644
--- a/sys/arch/sparc/dev/spif.c
+++ b/sys/arch/sparc/dev/spif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spif.c,v 1.26 2010/06/28 14:13:30 deraadt Exp $ */
+/* $OpenBSD: spif.c,v 1.27 2010/07/02 17:27:01 nicm Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
@@ -676,13 +676,7 @@ stty_start(tp)
s = spltty();
if (!ISSET(tp->t_state, TS_TTSTOP | TS_TIMEOUT | TS_BUSY)) {
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (ISSET(tp->t_state, TS_ASLEEP)) {
- CLR(tp->t_state, TS_ASLEEP);
- wakeup(&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
if (tp->t_outq.c_cc) {
sp->sp_txc = ndqb(&tp->t_outq, 0);
sp->sp_txp = tp->t_outq.c_cf;
diff --git a/sys/arch/sparc/dev/z8530tty.c b/sys/arch/sparc/dev/z8530tty.c
index c7765b4ee07..bfb68082ec4 100644
--- a/sys/arch/sparc/dev/z8530tty.c
+++ b/sys/arch/sparc/dev/z8530tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: z8530tty.c,v 1.16 2010/06/28 14:13:30 deraadt Exp $ */
+/* $OpenBSD: z8530tty.c,v 1.17 2010/07/02 17:27:01 nicm Exp $ */
/* $NetBSD: z8530tty.c,v 1.13 1996/10/16 20:42:14 gwr Exp $ */
/*-
@@ -878,15 +878,9 @@ zsstart(tp)
if (zst->zst_tx_stopped)
goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (ISSET(tp->t_state, TS_ASLEEP)) {
- CLR(tp->t_state, TS_ASLEEP);
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- if (tp->t_outq.c_cc == 0)
- goto out;
- }
+ ttwakeupwr(tp);
+ if (tp->t_outq.c_cc == 0)
+ goto out;
/* Grab the first contiguous region of buffer space. */
{
diff --git a/sys/arch/sparc64/dev/sab.c b/sys/arch/sparc64/dev/sab.c
index 12496c4aa5f..abbcbd8b334 100644
--- a/sys/arch/sparc64/dev/sab.c
+++ b/sys/arch/sparc64/dev/sab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sab.c,v 1.29 2010/06/28 14:13:31 deraadt Exp $ */
+/* $OpenBSD: sab.c,v 1.30 2010/07/02 17:27:01 nicm Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -1093,13 +1093,7 @@ sabtty_start(tp)
s = spltty();
if ((tp->t_state & (TS_TTSTOP | TS_TIMEOUT | TS_BUSY)) == 0) {
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup(&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
if (tp->t_outq.c_cc) {
sc->sc_txc = ndqb(&tp->t_outq, 0);
sc->sc_txp = tp->t_outq.c_cf;
diff --git a/sys/arch/sparc64/dev/sbbc.c b/sys/arch/sparc64/dev/sbbc.c
index d1ea24ad6e3..02d84098bdb 100644
--- a/sys/arch/sparc64/dev/sbbc.c
+++ b/sys/arch/sparc64/dev/sbbc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbbc.c,v 1.9 2010/06/28 14:13:31 deraadt Exp $ */
+/* $OpenBSD: sbbc.c,v 1.10 2010/07/02 17:27:01 nicm Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
*
@@ -623,13 +623,7 @@ sbbcstart(struct tty *tp)
splx(s);
return;
}
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0)
sbbc_cnputc(tp->t_dev, getc(&tp->t_outq));
diff --git a/sys/arch/sparc64/dev/vcctty.c b/sys/arch/sparc64/dev/vcctty.c
index 1d710e71188..b6e5bdceb9d 100644
--- a/sys/arch/sparc64/dev/vcctty.c
+++ b/sys/arch/sparc64/dev/vcctty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vcctty.c,v 1.5 2010/06/28 14:13:31 deraadt Exp $ */
+/* $OpenBSD: vcctty.c,v 1.6 2010/07/02 17:27:01 nicm Exp $ */
/*
* Copyright (c) 2009 Mark Kettenis
*
@@ -434,13 +434,7 @@ vccttystart(struct tty *tp)
splx(s);
return;
}
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0)
vcctty_send_data(sc, getc(&tp->t_outq));
diff --git a/sys/arch/sparc64/dev/vcons.c b/sys/arch/sparc64/dev/vcons.c
index 847883a38fb..b72a8272674 100644
--- a/sys/arch/sparc64/dev/vcons.c
+++ b/sys/arch/sparc64/dev/vcons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vcons.c,v 1.9 2010/06/28 14:13:31 deraadt Exp $ */
+/* $OpenBSD: vcons.c,v 1.10 2010/07/02 17:27:01 nicm Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
*
@@ -274,13 +274,7 @@ vconsstart(struct tty *tp)
splx(s);
return;
}
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0)
vcons_cnputc(tp->t_dev, getc(&tp->t_outq));
diff --git a/sys/arch/sparc64/dev/z8530tty.c b/sys/arch/sparc64/dev/z8530tty.c
index c485899c08d..d20f7c3137d 100644
--- a/sys/arch/sparc64/dev/z8530tty.c
+++ b/sys/arch/sparc64/dev/z8530tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: z8530tty.c,v 1.21 2010/06/28 14:13:31 deraadt Exp $ */
+/* $OpenBSD: z8530tty.c,v 1.22 2010/07/02 17:27:01 nicm Exp $ */
/* $NetBSD: z8530tty.c,v 1.77 2001/05/30 15:24:24 lukem Exp $ */
/*-
@@ -846,15 +846,9 @@ zsstart(tp)
if (zst->zst_tx_stopped)
goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (ISSET(tp->t_state, TS_ASLEEP)) {
- CLR(tp->t_state, TS_ASLEEP);
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- if (tp->t_outq.c_cc == 0)
- goto out;
- }
+ ttwakeupwr(tp);
+ if (tp->t_outq.c_cc == 0)
+ goto out;
/* Grab the first contiguous region of buffer space. */
{
diff --git a/sys/arch/vax/qbus/dhu.c b/sys/arch/vax/qbus/dhu.c
index 4704c654201..04b2ee25c24 100644
--- a/sys/arch/vax/qbus/dhu.c
+++ b/sys/arch/vax/qbus/dhu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhu.c,v 1.17 2010/06/28 14:13:31 deraadt Exp $ */
+/* $OpenBSD: dhu.c,v 1.18 2010/07/02 17:27:01 nicm Exp $ */
/* $NetBSD: dhu.c,v 1.19 2000/06/04 06:17:01 matt Exp $ */
/*
* Copyright (c) 2003, Hugh Graham.
@@ -639,13 +639,7 @@ dhustart(tp)
if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwakeupwr(tp);
if (tp->t_outq.c_cc == 0)
goto out;
cc = ndqb(&tp->t_outq, 0);
diff --git a/sys/arch/vax/qbus/dl.c b/sys/arch/vax/qbus/dl.c
index f337ce38329..e87ab207c59 100644
--- a/sys/arch/vax/qbus/dl.c
+++ b/sys/arch/vax/qbus/dl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dl.c,v 1.11 2010/06/28 14:13:31 deraadt Exp $ */
+/* $OpenBSD: dl.c,v 1.12 2010/07/02 17:27:01 nicm Exp $ */
/* $NetBSD: dl.c,v 1.11 2000/01/24 02:40:29 matt Exp $ */
/*-
@@ -456,18 +456,11 @@ dlstart(tp)
sc = dl_cd.cd_devs[unit];
s = spltty();
- if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
- goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
- if (tp->t_outq.c_cc == 0)
- goto out;
-
+ if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
+ goto out;
+ ttwakeupwr(tp);
+ if (tp->t_outq.c_cc == 0)
+ goto out;
if (DL_READ_WORD(DL_UBA_XCSR) & DL_XCSR_TX_READY) {
tp->t_state |= TS_BUSY;
diff --git a/sys/arch/vax/vxt/qsc.c b/sys/arch/vax/vxt/qsc.c
index 3e09171455e..9389fe60f3d 100644
--- a/sys/arch/vax/vxt/qsc.c
+++ b/sys/arch/vax/vxt/qsc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qsc.c,v 1.7 2010/06/28 14:13:32 deraadt Exp $ */
+/* $OpenBSD: qsc.c,v 1.8 2010/07/02 17:27:01 nicm Exp $ */
/*
* Copyright (c) 2006 Miodrag Vallat.
*
@@ -345,15 +345,9 @@ qscstart(struct tty *tp)
if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))
goto bail;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- if (tp->t_outq.c_cc == 0)
- goto bail;
- }
+ ttwakeupwr(tp);
+ if (tp->t_outq.c_cc == 0)
+ goto bail;
tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0) {