diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-09-20 23:30:30 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-09-20 23:30:30 +0000 |
commit | b7ad3a15d6dcf17e3b43cf3f32dcce8fc0760edb (patch) | |
tree | 1ad399cb32a3c750705d047a2fcb9041661432ff | |
parent | a7ab27c83c31e234cf74c1baab88a6a040d78de3 (diff) |
Better timeout usage.
-rw-r--r-- | sys/dev/ic/ncr5380sbc.c | 15 | ||||
-rw-r--r-- | sys/dev/ic/ncr5380var.h | 6 |
2 files changed, 12 insertions, 9 deletions
diff --git a/sys/dev/ic/ncr5380sbc.c b/sys/dev/ic/ncr5380sbc.c index 2f92efb7420..f5cb019d0b4 100644 --- a/sys/dev/ic/ncr5380sbc.c +++ b/sys/dev/ic/ncr5380sbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr5380sbc.c,v 1.11 2001/08/08 21:15:42 miod Exp $ */ +/* $OpenBSD: ncr5380sbc.c,v 1.12 2001/09/20 23:30:29 miod Exp $ */ /* $NetBSD: ncr5380sbc.c,v 1.13 1996/10/13 01:37:25 christos Exp $ */ /* @@ -356,13 +356,17 @@ ncr5380_init(sc) struct ncr5380_softc *sc; { int i, j; + struct sci_req *sr; #ifdef NCR5380_DEBUG ncr5380_debug_sc = sc; #endif - for (i = 0; i < SCI_OPENINGS; i++) - sc->sc_ring[i].sr_xs = NULL; + for (i = 0; i < SCI_OPENINGS; i++) { + sr = &sc->sc_ring[i]; + sr->sr_xs = NULL; + timeout_set(&sr->sr_timeout, ncr5380_cmd_timeout, sr); + } for (i = 0; i < 8; i++) for (j = 0; j < 8; j++) sc->sc_matrix[i][j] = NULL; @@ -802,7 +806,7 @@ finish: /* Clear our pointers to the request. */ sc->sc_current = NULL; sc->sc_matrix[sr->sr_target][sr->sr_lun] = NULL; - timeout_del(&sc->sc_timeout); + timeout_del(&sr->sr_timeout); /* Make the request free. */ sr->sr_xs = NULL; @@ -1041,8 +1045,7 @@ next_job: if ((sr->sr_flags & SR_IMMED) == 0) { i = (xs->timeout * hz) / 1000; NCR_TRACE("sched: set timeout=%d\n", i); - timeout_set(&sc->sc_timeout, ncr5380_cmd_timeout, sr); - timeout_add(&sc->sc_timeout, i); + timeout_add(&sr->sr_timeout, i); } have_nexus: diff --git a/sys/dev/ic/ncr5380var.h b/sys/dev/ic/ncr5380var.h index 03e9a5be64e..753f42eb431 100644 --- a/sys/dev/ic/ncr5380var.h +++ b/sys/dev/ic/ncr5380var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr5380var.h,v 1.6 2001/08/08 21:15:42 miod Exp $ */ +/* $OpenBSD: ncr5380var.h,v 1.7 2001/09/20 23:30:29 miod Exp $ */ /* $NetBSD: ncr5380var.h,v 1.6 1996/05/10 18:04:06 gwr Exp $ */ /* @@ -72,6 +72,8 @@ struct sci_req { #define SR_OVERDUE 4 /* Timeout while not current */ #define SR_ERROR 8 /* Error occurred */ int sr_status; /* Status code from last cmd */ + + struct timeout sr_timeout; }; #define SCI_OPENINGS 16 /* How many commands we can enqueue. */ @@ -166,8 +168,6 @@ struct ncr5380_softc { u_char *sc_omp; /* Outgoing message pointer */ u_char sc_imess[NCR_MAX_MSG_LEN]; u_char *sc_imp; /* Incoming message pointer */ - - struct timeout sc_timeout; }; void ncr5380_init __P((struct ncr5380_softc *)); |