From: deraadt Date: Thu, 30 Nov 1995 22:59:06 +0000 (+0000) Subject: correct way to call tsleep is almost always "while (condition) tsleep(...)" X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f740b26dca924248b739901c9b9efafbc228c56f;p=openbsd correct way to call tsleep is almost always "while (condition) tsleep(...)" --- diff --git a/sys/dev/isa/aha.c b/sys/dev/isa/aha.c index d516a8d6421..1049d677dfe 100644 --- a/sys/dev/isa/aha.c +++ b/sys/dev/isa/aha.c @@ -71,9 +71,10 @@ #define Debugger() panic("should call debugger here (aha1542.c)") #endif /* ! DDB */ -/* XXX fixme: */ -/* on i386 at least xfers from/to user memory */ -/* cannot be serviced at interrupt time. */ +/* XXX fixme: + * on i386 at least, xfers to/from user memory + * cannot be serviced at interrupt time. + */ #ifdef i386 #include #define VOLATILE_XS(xs) \ @@ -1329,9 +1330,10 @@ aha_scsi_cmd(xs) SC_DEBUG(sc_link, SDEV_DB3, ("cmd_sent\n")); if (VOLATILE_XS(xs)) { - if (tsleep(ccb, PRIBIO, "ahawait", (xs->timeout * hz) / 1000)) { - aha_timeout(ccb); - tsleep(ccb, PRIBIO, "ahawait1", 2000); + timeout(aha_timeout, ccb, (xs->timeout * hz) / 1000); + while ((ccb->xs->flags & ITSDONE) == 0) { + tsleep(ccb, PRIBIO, "ahawait", + (xs->timeout * hz) / 1000); } splx(s); if (ccb->data_nseg) { diff --git a/sys/dev/isa/aha1542.c b/sys/dev/isa/aha1542.c index d516a8d6421..1049d677dfe 100644 --- a/sys/dev/isa/aha1542.c +++ b/sys/dev/isa/aha1542.c @@ -71,9 +71,10 @@ #define Debugger() panic("should call debugger here (aha1542.c)") #endif /* ! DDB */ -/* XXX fixme: */ -/* on i386 at least xfers from/to user memory */ -/* cannot be serviced at interrupt time. */ +/* XXX fixme: + * on i386 at least, xfers to/from user memory + * cannot be serviced at interrupt time. + */ #ifdef i386 #include #define VOLATILE_XS(xs) \ @@ -1329,9 +1330,10 @@ aha_scsi_cmd(xs) SC_DEBUG(sc_link, SDEV_DB3, ("cmd_sent\n")); if (VOLATILE_XS(xs)) { - if (tsleep(ccb, PRIBIO, "ahawait", (xs->timeout * hz) / 1000)) { - aha_timeout(ccb); - tsleep(ccb, PRIBIO, "ahawait1", 2000); + timeout(aha_timeout, ccb, (xs->timeout * hz) / 1000); + while ((ccb->xs->flags & ITSDONE) == 0) { + tsleep(ccb, PRIBIO, "ahawait", + (xs->timeout * hz) / 1000); } splx(s); if (ccb->data_nseg) {