From ca63b430b7515c7a0e44e9f77e43a385f5561ce6 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Mon, 13 May 2002 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2002-05-13 --- pc/usbuhci.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/pc/usbuhci.c b/pc/usbuhci.c index 776603824ac069a37726a9baa001f23e7962375d..c28217e6492c94efda38d6a62839a2448c9908a1 100644 --- a/pc/usbuhci.c +++ b/pc/usbuhci.c @@ -1071,13 +1071,27 @@ eptinput(void *arg) return e->eof || e->err || qcanread(e->rq); } +static int +isoreadyx(Endptx *x) +{ + return x->etd == nil || (x->etd != x->xtd && (x->etd->status & Active) == 0); +} + static int isoready(void *arg) { + int ret; + Ctlr *ctlr; + Endpt *e; Endptx *x; - x = arg; - return x->etd == nil || (x->etd != x->xtd && (x->etd->status & Active) == 0); + e = arg; + ctlr = e->dev->uh->ctlr; + x = e->private; + ilock(&ctlr->activends); + ret = isoreadyx(x); + iunlock(&ctlr->activends); + return ret; } static long @@ -1151,13 +1165,13 @@ isoio(Ctlr *ctlr, Endpt *e, void *a, long n, ulong offset, int w) e->off = 0; }else{ /* New td, make sure it's ready */ - isolock = 0; - iunlock(&ctlr->activends); - while (isoready(x) == 0){ - sleep(&e->wr, isoready, x); + while (isoreadyx(x) == 0){ + isolock = 0; + iunlock(&ctlr->activends); + sleep(&e->wr, isoready, e); + ilock(&ctlr->activends); + isolock = 1; } - ilock(&ctlr->activends); - isolock = 1; if (x->etd == nil){ XPRINT("!"); continue;