summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheloha <cheloha@cvs.openbsd.org>2020-02-19 01:31:39 +0000
committercheloha <cheloha@cvs.openbsd.org>2020-02-19 01:31:39 +0000
commit693f28f551b7dd13d55242557926b567e4427a76 (patch)
tree8393f10895d646e8b990603c000faa720164e801
parent8ddf80722fee841a2ca01df39f34d8fb9fd5ca94 (diff)
ips(4): tsleep(9) -> tsleep_nsec(9)
While here, get rid of the "timo" variable completely. In the SCSI_NOSLEEP path of ips_poll() use "usecs" and in the opposite path use "msecs". ok krw@
-rw-r--r--sys/dev/pci/ips.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/sys/dev/pci/ips.c b/sys/dev/pci/ips.c
index 41c0602337f..a448f0d17f3 100644
--- a/sys/dev/pci/ips.c
+++ b/sys/dev/pci/ips.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ips.c,v 1.117 2020/02/14 18:37:03 krw Exp $ */
+/* $OpenBSD: ips.c,v 1.118 2020/02/19 01:31:38 cheloha Exp $ */
/*
* Copyright (c) 2006, 2007, 2009 Alexander Yurchenko <grange@openbsd.org>
@@ -1409,8 +1409,7 @@ ips_cmd(struct ips_softc *sc, struct ips_ccb *ccb)
int
ips_poll(struct ips_softc *sc, struct ips_ccb *ccb)
{
- struct timeval tv;
- int error, timo;
+ int error, msecs, usecs;
splassert(IPL_BIO);
@@ -1419,7 +1418,7 @@ ips_poll(struct ips_softc *sc, struct ips_ccb *ccb)
DPRINTF(IPS_D_XFER, ("%s: ips_poll: busy-wait\n",
sc->sc_dev.dv_xname));
- for (timo = 10000; timo > 0; timo--) {
+ for (usecs = 1000000; usecs > 0; usecs -= 100) {
delay(100);
ips_intr(sc);
if (ccb->c_state == IPS_CCB_DONE)
@@ -1427,14 +1426,11 @@ ips_poll(struct ips_softc *sc, struct ips_ccb *ccb)
}
} else {
/* sleep */
- timo = ccb->c_xfer ? ccb->c_xfer->timeout : IPS_TIMEOUT;
- tv.tv_sec = timo / 1000;
- tv.tv_usec = (timo % 1000) * 1000;
- timo = tvtohz(&tv);
-
- DPRINTF(IPS_D_XFER, ("%s: ips_poll: sleep %d hz\n",
- sc->sc_dev.dv_xname, timo));
- tsleep(ccb, PRIBIO + 1, "ipscmd", timo);
+ msecs = ccb->c_xfer ? ccb->c_xfer->timeout : IPS_TIMEOUT;
+
+ DPRINTF(IPS_D_XFER, ("%s: ips_poll: sleep %d ms\n",
+ sc->sc_dev.dv_xname, msecs));
+ tsleep_nsec(ccb, PRIBIO + 1, "ipscmd", MSEC_TO_NSEC(msecs));
}
DPRINTF(IPS_D_XFER, ("%s: ips_poll: state %d\n", sc->sc_dev.dv_xname,
ccb->c_state));