diff options
author | 2020-12-04 03:22:46 +0000 | |
---|---|---|
committer | 2020-12-04 03:22:46 +0000 | |
commit | b910befeab16781cf4c5c1347d1822118675112d (patch) | |
tree | d27d79191bc426cba72f28f2b7012b00b3d32f9f | |
parent | shuffle a few utility functions into sftp-client.c; from Jakub Jelen (diff) | |
download | wireguard-openbsd-b910befeab16781cf4c5c1347d1822118675112d.tar.xz wireguard-openbsd-b910befeab16781cf4c5c1347d1822118675112d.zip |
hvn(4), hyperv(4): more tsleep(9) -> tsleep_nsec(9) conversions
Replace all tsleep(..., 1) calls in these drivers with tsleep_nsec(9)
calls. In every case we can use the nearby delay(9) intervals as the
timeout.
Tested by Andre Stoebe <as@nul.space> (Hyper-V on Windows 10).
"LGTM" mikeb@, ok mpi@
-rw-r--r-- | sys/dev/pv/hyperv.c | 12 | ||||
-rw-r--r-- | sys/dev/pv/if_hvn.c | 24 |
2 files changed, 24 insertions, 12 deletions
diff --git a/sys/dev/pv/hyperv.c b/sys/dev/pv/hyperv.c index b9ee2feec4c..4a695cc4517 100644 --- a/sys/dev/pv/hyperv.c +++ b/sys/dev/pv/hyperv.c @@ -558,8 +558,10 @@ hv_start(struct hv_softc *sc, struct hv_msg *msg) s = splnet(); hv_intr(); splx(s); - } else - tsleep(wchan, PRIBIO, wchan, 1); + } else { + tsleep_nsec(wchan, PRIBIO, wchan, + USEC_TO_NSEC(delays[i])); + } } if (status != 0) { printf("%s: posting vmbus message failed with %d\n", @@ -620,8 +622,10 @@ hv_wait(struct hv_softc *sc, int (*cond)(struct hv_softc *, struct hv_msg *), s = splnet(); hv_intr(); splx(s); - } else - tsleep(wchan, PRIBIO, wmsg ? wmsg : "hvwait", 1); + } else { + tsleep_nsec(wchan, PRIBIO, wmsg ? wmsg : "hvwait", + USEC_TO_NSEC(1000)); + } } } diff --git a/sys/dev/pv/if_hvn.c b/sys/dev/pv/if_hvn.c index 0081eac5c1f..ec96bc788d0 100644 --- a/sys/dev/pv/if_hvn.c +++ b/sys/dev/pv/if_hvn.c @@ -1048,8 +1048,10 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *cmd, size_t cmdsize, uint64_t tid, if (rv == EAGAIN) { if (cold) delay(1000); - else - tsleep(cmd, PRIBIO, "nvsout", 1); + else { + tsleep_nsec(cmd, PRIBIO, "nvsout", + USEC_TO_NSEC(1000)); + } } else if (rv) { DPRINTF("%s: NVSP operation %u send error %d\n", sc->sc_dev.dv_xname, hdr->nvs_type, rv); @@ -1069,8 +1071,10 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *cmd, size_t cmdsize, uint64_t tid, do { if (cold) delay(1000); - else - tsleep(sc, PRIBIO | PCATCH, "nvscmd", 1); + else { + tsleep_nsec(sc, PRIBIO | PCATCH, "nvscmd", + USEC_TO_NSEC(1000)); + } s = splnet(); hvn_nvs_intr(sc); splx(s); @@ -1366,8 +1370,10 @@ hvn_rndis_cmd(struct hvn_softc *sc, struct rndis_cmd *rc, int timo) if (rv == EAGAIN) { if (cold) delay(100); - else - tsleep(rc, PRIBIO, "rndisout", 1); + else { + tsleep_nsec(rc, PRIBIO, "rndisout", + USEC_TO_NSEC(100)); + } } else if (rv) { DPRINTF("%s: RNDIS operation %u send error %d\n", sc->sc_dev.dv_xname, hdr->rm_type, rv); @@ -1388,8 +1394,10 @@ hvn_rndis_cmd(struct hvn_softc *sc, struct rndis_cmd *rc, int timo) do { if (cold) delay(1000); - else - tsleep(rc, PRIBIO | PCATCH, "rndiscmd", 1); + else { + tsleep_nsec(rc, PRIBIO | PCATCH, "rndiscmd", + USEC_TO_NSEC(1000)); + } s = splnet(); hvn_nvs_intr(sc); splx(s); |