diff options
author | cheloha <cheloha@cvs.openbsd.org> | 2020-12-08 04:37:28 +0000 |
---|---|---|
committer | cheloha <cheloha@cvs.openbsd.org> | 2020-12-08 04:37:28 +0000 |
commit | b11f5e4a566a103ff615f360f42acacce7d72167 (patch) | |
tree | 733f742ec6e10e31821fe7a1a937926f91b17bde /sys | |
parent | ac3fec1d4339cc3bd6f1677055f433274066b951 (diff) |
an(4): tsleep(9) -> tsleep_nsec(9)
In an_wait() we spin for up to (3 * hz) iterations awaiting AN_EV_CMD.
If we don't see it in a given iteration we block for up to 1 tick and
spin again.
jsg@ suggests instead blocking for 100ms at a time for up to 30
iterations.
Discussed with mpi@. Idea from jsg@. Murmurs of agreement from
claudio@ and kettenis@.
probably ok jsg@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/an.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c index e92aa27a7f0..97bc598dc66 100644 --- a/sys/dev/ic/an.c +++ b/sys/dev/ic/an.c @@ -1,4 +1,4 @@ -/* $OpenBSD: an.c,v 1.76 2020/07/10 13:26:37 patrick Exp $ */ +/* $OpenBSD: an.c,v 1.77 2020/12/08 04:37:27 cheloha Exp $ */ /* $NetBSD: an.c,v 1.34 2005/06/20 02:49:18 atatat Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -681,10 +681,10 @@ an_wait(struct an_softc *sc) int i; CSR_WRITE_2(sc, AN_COMMAND, AN_CMD_NOOP2); - for (i = 0; i < 3*hz; i++) { + for (i = 0; i < 3000; i += 100) { if (CSR_READ_2(sc, AN_EVENT_STAT) & AN_EV_CMD) break; - (void)tsleep(sc, PWAIT, "anatch", 1); + tsleep_nsec(sc, PWAIT, "anatch", MSEC_TO_NSEC(100)); } CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_CMD); } |