From ebb5694a4b27c87977731dfc280b6d5a47c9e0d7 Mon Sep 17 00:00:00 2001 From: Gary Jennejohn Date: Mon, 10 Nov 2003 14:20:34 +0000 Subject: [PATCH] Based on an excellent suggestion from tanimura@ define I4BPRI and use it in place of TTIPRI. --- sys/i4b/driver/i4b_rbch.c | 21 +++++++-------------- sys/i4b/driver/i4b_tel.c | 25 +++++++++---------------- sys/i4b/driver/i4b_trace.c | 9 +-------- sys/i4b/include/i4b_global.h | 3 +++ sys/i4b/layer4/i4b_i4bdrv.c | 11 ++--------- 5 files changed, 22 insertions(+), 47 deletions(-) diff --git a/sys/i4b/driver/i4b_rbch.c b/sys/i4b/driver/i4b_rbch.c index 271eb66b26cf..cb68c6cd53cb 100644 --- a/sys/i4b/driver/i4b_rbch.c +++ b/sys/i4b/driver/i4b_rbch.c @@ -126,13 +126,6 @@ static struct cdevsw i4brbch_cdevsw = { static void i4brbchattach(void *); PSEUDO_SET(i4brbchattach, i4b_rbch); -#if __FreeBSD_version >= 501113 -#ifndef TTIPRI -/* don't want to include tty.h just to get this */ -#define TTIPRI (PSOCK + 1) -#endif -#endif - /*===========================================================================* * DEVICE DRIVER ROUTINES *===========================================================================*/ @@ -263,7 +256,7 @@ i4brbchread(dev_t dev, struct uio *uio, int ioflag) NDBGL4(L4_RBCHDBG, "unit %d, wait read init", unit); if((error = tsleep( &rbch_softc[unit], - TTIPRI | PCATCH, + I4BPRI | PCATCH, "rrrbch", 0 )) != 0) { CRIT_END; @@ -284,7 +277,7 @@ i4brbchread(dev_t dev, struct uio *uio, int ioflag) NDBGL4(L4_RBCHDBG, "unit %d, wait read data", unit); if((error = tsleep( &isdn_linktab[unit]->rx_queue, - TTIPRI | PCATCH, + I4BPRI | PCATCH, "rrbch", 0 )) != 0) { CRIT_END; @@ -358,7 +351,7 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag) NDBGL4(L4_RBCHDBG, "unit %d, write wait init", unit); error = tsleep( &rbch_softc[unit], - TTIPRI | PCATCH, + I4BPRI | PCATCH, "wrrbch", 0 ); if(error == ERESTART) { CRIT_END; @@ -376,7 +369,7 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag) NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep init", unit, error); return(error); } - tsleep( &rbch_softc[unit], TTIPRI | PCATCH, "xrbch", (hz*1)); + tsleep( &rbch_softc[unit], I4BPRI | PCATCH, "xrbch", (hz*1)); } while(_IF_QFULL(isdn_linktab[unit]->tx_queue) && (sc->sc_devstate & ST_ISOPEN)) @@ -386,7 +379,7 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag) NDBGL4(L4_RBCHDBG, "unit %d, write queue full", unit); if ((error = tsleep( &isdn_linktab[unit]->tx_queue, - TTIPRI | PCATCH, + I4BPRI | PCATCH, "wrbch", 0)) != 0) { sc->sc_devstate &= ~ST_WRWAITEMPTY; if(error == ERESTART) @@ -745,7 +738,7 @@ rbch_rx_data_rdy(int unit) { NDBGL4(L4_RBCHDBG, "unit %d, NO wakeup", unit); } - selwakeuppri(&rbch_softc[unit].selp, TTIPRI); + selwakeuppri(&rbch_softc[unit].selp, I4BPRI); } /*---------------------------------------------------------------------------* @@ -778,7 +771,7 @@ rbch_activity(int unit, int rxtx) { if (rbch_softc[unit].sc_cd) rbch_softc[unit].sc_cd->last_active_time = SECOND; - selwakeuppri(&rbch_softc[unit].selp, TTIPRI); + selwakeuppri(&rbch_softc[unit].selp, I4BPRI); } /*---------------------------------------------------------------------------* diff --git a/sys/i4b/driver/i4b_tel.c b/sys/i4b/driver/i4b_tel.c index 4b939704e34b..de0833dac5c5 100644 --- a/sys/i4b/driver/i4b_tel.c +++ b/sys/i4b/driver/i4b_tel.c @@ -149,13 +149,6 @@ static void i4btelattach(void *); PSEUDO_SET(i4btelattach, i4b_tel); -#if __FreeBSD_version >= 501113 -#ifndef TTIPRI -/* don't want to include tty.h just to get this */ -#define TTIPRI (PSOCK + 1) -#endif -#endif - /*===========================================================================* * DEVICE DRIVER ROUTINES *===========================================================================*/ @@ -256,7 +249,7 @@ i4btelclose(dev_t dev, int flag, int fmt, struct thread *td) sc->devstate |= ST_WRWAITEMPTY; if((error = tsleep( &sc->isdn_linktab->tx_queue, - TTIPRI | PCATCH, "wtcl", 0)) != 0) + I4BPRI | PCATCH, "wtcl", 0)) != 0) { break; } @@ -353,7 +346,7 @@ i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) while ((sc->devstate & ST_TONE) && sc->tones.duration[sc->toneidx] != 0) { if((error = tsleep( &sc->tones, - TTIPRI | PCATCH, "rtone", 0 )) != 0) { + I4BPRI | PCATCH, "rtone", 0 )) != 0) { splx(s); return(error); } @@ -426,7 +419,7 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag) if((error = msleep( &sc->isdn_linktab->rx_queue, &sc->isdn_linktab->rx_queue->ifq_mtx, - TTIPRI | PCATCH, + I4BPRI | PCATCH, "rtel", 0 )) != 0) { sc->devstate &= ~ST_RDWAITDATA; @@ -492,7 +485,7 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag) NDBGL4(L4_TELDBG, "i4btel%d, wait for result!", unit); if((error = tsleep( &sc->result, - TTIPRI | PCATCH, + I4BPRI | PCATCH, "rtel1", 0 )) != 0) { sc->devstate &= ~ST_RDWAITDATA; @@ -562,7 +555,7 @@ i4btelwrite(dev_t dev, struct uio * uio, int ioflag) if((error = msleep( &sc->isdn_linktab->tx_queue, &sc->isdn_linktab->tx_queue->ifq_mtx, - TTIPRI | PCATCH, "wtel", 0)) != 0) + I4BPRI | PCATCH, "wtel", 0)) != 0) { sc->devstate &= ~ST_WRWAITEMPTY; IF_UNLOCK(sc->isdn_linktab->tx_queue); @@ -798,7 +791,7 @@ tel_connect(int unit, void *cdp) sc->devstate &= ~ST_RDWAITDATA; wakeup( &sc->result); } - selwakeuppri(&sc->selp, TTIPRI); + selwakeuppri(&sc->selp, I4BPRI); } } @@ -842,7 +835,7 @@ tel_disconnect(int unit, void *cdp) sc->devstate &= ~ST_RDWAITDATA; wakeup( &sc->result); } - selwakeuppri(&sc->selp, TTIPRI); + selwakeuppri(&sc->selp, I4BPRI); if (sc->devstate & ST_TONE) { sc->devstate &= ~ST_TONE; @@ -871,7 +864,7 @@ tel_dialresponse(int unit, int status, cause_t cause) sc->devstate &= ~ST_RDWAITDATA; wakeup( &sc->result); } - selwakeuppri(&sc->selp, TTIPRI); + selwakeuppri(&sc->selp, I4BPRI); } } @@ -919,7 +912,7 @@ tel_tx_queue_empty(int unit) if(sc->devstate & ST_TONE) { tel_tone(sc); } else { - selwakeuppri(&sc->selp, TTIPRI); + selwakeuppri(&sc->selp, I4BPRI); } } diff --git a/sys/i4b/driver/i4b_trace.c b/sys/i4b/driver/i4b_trace.c index 586a68da8c8a..ea92b18884ab 100644 --- a/sys/i4b/driver/i4b_trace.c +++ b/sys/i4b/driver/i4b_trace.c @@ -90,13 +90,6 @@ PSEUDO_SET(i4btrcattach, i4b_trace); int get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf); -#if __FreeBSD_version >= 501113 -#ifndef TTIPRI -/* don't want to include tty.h just to get this */ -#define TTIPRI (PSOCK + 1) -#endif -#endif - /*---------------------------------------------------------------------------* * interface attach routine *---------------------------------------------------------------------------*/ @@ -323,7 +316,7 @@ i4btrcread(dev_t dev, struct uio * uio, int ioflag) if((error = msleep( &trace_queue[unit], &trace_queue[unit].ifq_mtx, - TTIPRI | PCATCH, + I4BPRI | PCATCH, "bitrc", 0 )) != 0) { device_state[unit] &= ~ST_WAITDATA; diff --git a/sys/i4b/include/i4b_global.h b/sys/i4b/include/i4b_global.h index c24527703d2a..fe1bb7177b00 100644 --- a/sys/i4b/include/i4b_global.h +++ b/sys/i4b/include/i4b_global.h @@ -94,6 +94,9 @@ #define TIMER_IDLE 1 /* a timer is running */ #define TIMER_ACTIVE 2 /* a timer is idle */ +/* priority */ +#define I4BPRI (PSOCK + 1) + /* i4b's spl */ #define SPLI4B() splimp() /* spl for i4b */ diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c index 648a09722dc6..e17ad85e3dfe 100644 --- a/sys/i4b/layer4/i4b_i4bdrv.c +++ b/sys/i4b/layer4/i4b_i4bdrv.c @@ -91,13 +91,6 @@ static struct cdevsw i4b_cdevsw = { static void i4battach(void *); PSEUDO_SET(i4battach, i4b_i4bdrv); -#if __FreeBSD_version >= 501113 -#ifndef TTIPRI -/* don't want to include tty.h just to get this */ -#define TTIPRI (PSOCK + 1) -#endif -#endif - /*---------------------------------------------------------------------------* * interface attach routine *---------------------------------------------------------------------------*/ @@ -827,7 +820,7 @@ i4bputqueue(struct mbuf *m) if(selflag) { selflag = 0; - selwakeuppri(&select_rd_info, TTIPRI); + selwakeuppri(&select_rd_info, I4BPRI); } } @@ -870,6 +863,6 @@ i4bputqueue_hipri(struct mbuf *m) if(selflag) { selflag = 0; - selwakeuppri(&select_rd_info, TTIPRI); + selwakeuppri(&select_rd_info, I4BPRI); } }