summaryrefslogtreecommitdiff
path: root/sys/arch/macppc
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-12-25 23:02:27 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-12-25 23:02:27 +0000
commitf817c58ea799274eb832d25dc61acb5955f9b2d9 (patch)
treed81a72a842cf99a20e3b22543a17b8e53ad25961 /sys/arch/macppc
parentf1b1a2a9897fb5e4903d7922e7d05f99ad07b847 (diff)
Use list and queue macros where applicable to make the code easier to read;
no functional change.
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r--sys/arch/macppc/dev/mesh.c30
-rw-r--r--sys/arch/macppc/dev/snapper.c4
-rw-r--r--sys/arch/macppc/macppc/autoconf.c13
3 files changed, 20 insertions, 27 deletions
diff --git a/sys/arch/macppc/dev/mesh.c b/sys/arch/macppc/dev/mesh.c
index 748e13e83ea..9406e926532 100644
--- a/sys/arch/macppc/dev/mesh.c
+++ b/sys/arch/macppc/dev/mesh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mesh.c,v 1.8 2004/01/09 22:57:09 jmc Exp $ */
+/* $OpenBSD: mesh.c,v 1.9 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: mesh.c,v 1.1 1999/02/19 13:06:03 tsubai Exp $ */
/*-
@@ -909,7 +909,7 @@ mesh_get_scb(sc)
int s;
s = splbio();
- while ((scb = sc->free_scb.tqh_first) == NULL)
+ while ((scb = TAILQ_FIRST(&sc->free_scb)) == NULL)
tsleep(&sc->free_scb, PRIBIO, "meshscb", 0);
TAILQ_REMOVE(&sc->free_scb, scb, chain);
splx(s);
@@ -926,7 +926,7 @@ mesh_free_scb(sc, scb)
s = splbio();
TAILQ_INSERT_HEAD(&sc->free_scb, scb, chain);
- if (scb->chain.tqe_next == NULL)
+ if (TAILQ_NEXT(&scb->chain) == NULL)
wakeup(&sc->free_scb);
splx(s);
}
@@ -1005,23 +1005,17 @@ mesh_sched(sc)
struct scsi_link *sc_link;
struct mesh_scb *scb;
- scb = sc->ready_scb.tqh_first;
-start:
- if (scb == NULL)
- return;
-
- xs = scb->xs;
- sc_link = xs->sc_link;
+ TAILQ_FOREACH(scb, &sc->ready_scb, chain) {
+ xs = scb->xs;
+ sc_link = xs->sc_link;
- if (sc->sc_nexus == NULL) {
- TAILQ_REMOVE(&sc->ready_scb, scb, chain);
- sc->sc_nexus = scb;
- mesh_select(sc, scb);
- return;
+ if (sc->sc_nexus == NULL) {
+ TAILQ_REMOVE(&sc->ready_scb, scb, chain);
+ sc->sc_nexus = scb;
+ mesh_select(sc, scb);
+ return;
+ }
}
-
- scb = scb->chain.tqe_next;
- goto start;
}
int
diff --git a/sys/arch/macppc/dev/snapper.c b/sys/arch/macppc/dev/snapper.c
index 1753dd1d942..0f0ec11312f 100644
--- a/sys/arch/macppc/dev/snapper.c
+++ b/sys/arch/macppc/dev/snapper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snapper.c,v 1.6 2004/12/25 19:01:01 miod Exp $ */
+/* $OpenBSD: snapper.c,v 1.7 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: snapper.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */
/*-
@@ -383,7 +383,7 @@ snapper_defer(struct device *dev)
struct snapper_softc *sc = (struct snapper_softc *)dev;
struct device *dv;
- for (dv = alldevs.tqh_first; dv; dv=dv->dv_list.tqe_next)
+ TAILQ_FOREACH(dv, &alldevs, dv_list)
if (strncmp(dv->dv_xname, "ki2c", 4) == 0 &&
strncmp(dv->dv_parent->dv_xname, "macobio", 7) == 0)
sc->sc_i2c = dv;
diff --git a/sys/arch/macppc/macppc/autoconf.c b/sys/arch/macppc/macppc/autoconf.c
index d9926bb5128..20159656193 100644
--- a/sys/arch/macppc/macppc/autoconf.c
+++ b/sys/arch/macppc/macppc/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.14 2003/10/21 17:05:55 drahn Exp $ */
+/* $OpenBSD: autoconf.c,v 1.15 2004/12/25 23:02:24 miod Exp $ */
/*
* Copyright (c) 1996, 1997 Per Fogelstrom
* Copyright (c) 1995 Theo de Raadt
@@ -37,7 +37,7 @@
* from: Utah Hdr: autoconf.c 1.31 91/01/21
*
* from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93
- * $Id: autoconf.c,v 1.14 2003/10/21 17:05:55 drahn Exp $
+ * $Id: autoconf.c,v 1.15 2004/12/25 23:02:24 miod Exp $
*/
/*
@@ -241,8 +241,7 @@ getdisk(char *str, int len, int defpart, dev_t *devp)
if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
printf("use one of:");
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -272,7 +271,7 @@ parsedisk(char *str, int len, int defpart, dev_t *devp)
} else
part = defpart;
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
majdev = findblkmajor(dv);
@@ -517,7 +516,7 @@ gotswap:
struct device *
getdevunit(char *name, int unit)
{
- struct device *dev = alldevs.tqh_first;
+ struct device *dev = TAILQ_FIRST(&alldevs);
char num[10], fullname[16];
int lunit;
@@ -531,7 +530,7 @@ getdevunit(char *name, int unit)
strlcat(fullname, num, sizeof fullname);
while (strcmp(dev->dv_xname, fullname) != 0)
- if ((dev = dev->dv_list.tqe_next) == NULL)
+ if ((dev = TAILQ_NEXT(dev, dv_list)) == NULL)
return NULL;
return dev;