diff options
| author | drochner <drochner@NetBSD.org> | 2005-08-25 18:35:38 +0000 |
|---|---|---|
| committer | drochner <drochner@NetBSD.org> | 2005-08-25 18:35:38 +0000 |
| commit | fa3cb84d6262bbf1db28e9d4d55ca3842a1d09e3 (patch) | |
| tree | 11ffeefbbae1cf974abb0fbc0c79eaffe1f7a506 /sys/dev/tc | |
| parent | ede55d75e5923dcb6b25383599fa8f9c8b8a36c0 (diff) | |
replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
Diffstat (limited to 'sys/dev/tc')
| -rw-r--r-- | sys/dev/tc/ioasic_subr.c | 16 | ||||
| -rw-r--r-- | sys/dev/tc/tc.c | 29 | ||||
| -rw-r--r-- | sys/dev/tc/tcds.c | 18 | ||||
| -rw-r--r-- | sys/dev/tc/zs_ioasic.c | 18 |
4 files changed, 36 insertions, 45 deletions
diff --git a/sys/dev/tc/ioasic_subr.c b/sys/dev/tc/ioasic_subr.c index 2f8b146f483..1d4b2d9bd90 100644 --- a/sys/dev/tc/ioasic_subr.c +++ b/sys/dev/tc/ioasic_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ioasic_subr.c,v 1.8 2005/02/27 00:27:49 perry Exp $ */ +/* $NetBSD: ioasic_subr.c,v 1.9 2005/08/25 18:35:40 drochner Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ioasic_subr.c,v 1.8 2005/02/27 00:27:49 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ioasic_subr.c,v 1.9 2005/08/25 18:35:40 drochner Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -58,11 +58,11 @@ ioasicprint(aux, pnp) int ioasicsubmatch(struct device *parent, struct cfdata *cf, - const locdesc_t *ldesc, void *aux) + const locdesc_t *locs, void *aux) { if ((cf->cf_loc[IOASICCF_OFFSET] != IOASICCF_OFFSET_DEFAULT) && - (cf->cf_loc[IOASICCF_OFFSET] != ldesc->locs[IOASICCF_OFFSET])) + (cf->cf_loc[IOASICCF_OFFSET] != locs[IOASICCF_OFFSET])) return (0); return (config_match(parent, cf, aux)); @@ -76,8 +76,7 @@ ioasic_attach_devs(sc, ioasic_devs, ioasic_ndevs) { struct ioasicdev_attach_args idev; int i; - int help[2]; - locdesc_t *ldesc = (void *)help; /* XXX */ + int locs[IOASICCF_NLOCS]; /* * Try to configure each device. @@ -90,9 +89,8 @@ ioasic_attach_devs(sc, ioasic_devs, ioasic_ndevs) idev.iada_cookie = ioasic_devs[i].iad_cookie; /* Tell the autoconfig machinery we've found the hardware. */ - ldesc->len = 1; - ldesc->locs[IOASICCF_OFFSET] = ioasic_devs[i].iad_offset; - config_found_sm_loc(&sc->sc_dv, "ioasic", ldesc, &idev, + locs[IOASICCF_OFFSET] = ioasic_devs[i].iad_offset; + config_found_sm_loc(&sc->sc_dv, "ioasic", locs, &idev, ioasicprint, ioasicsubmatch); } } diff --git a/sys/dev/tc/tc.c b/sys/dev/tc/tc.c index 56567cf5b6d..c29572a356d 100644 --- a/sys/dev/tc/tc.c +++ b/sys/dev/tc/tc.c @@ -1,4 +1,4 @@ -/* $NetBSD: tc.c,v 1.40 2005/02/04 02:10:48 perry Exp $ */ +/* $NetBSD: tc.c,v 1.41 2005/08/25 18:35:40 drochner Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tc.c,v 1.40 2005/02/04 02:10:48 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tc.c,v 1.41 2005/08/25 18:35:40 drochner Exp $"); #include "opt_tcverbose.h" @@ -82,8 +82,7 @@ tcattach(parent, self, aux) struct tc_slotdesc *slot; tc_addr_t tcaddr; int i; - int help[3]; - locdesc_t *ldesc = (void *)&help; /* XXX */ + int locs[TCCF_NLOCS]; printf(": %s MHz clock\n", tba->tba_speed == TC_SPEED_25_MHZ ? "25" : "12.5"); @@ -136,13 +135,12 @@ tcattach(parent, self, aux) */ sc->sc_slots[builtin->tcb_slot].tcs_used = 1; - ldesc->len = 2; - ldesc->locs[TCCF_SLOT] = builtin->tcb_slot; - ldesc->locs[TCCF_OFFSET] = builtin->tcb_offset; + locs[TCCF_SLOT] = builtin->tcb_slot; + locs[TCCF_OFFSET] = builtin->tcb_offset; /* * Attach the device. */ - config_found_sm_loc(self, "tc", ldesc, &ta, + config_found_sm_loc(self, "tc", locs, &ta, tcprint, tcsubmatch); } @@ -180,13 +178,12 @@ tcattach(parent, self, aux) */ slot->tcs_used = 1; - ldesc->len = 2; - ldesc->locs[TCCF_SLOT] = i; - ldesc->locs[TCCF_OFFSET] = 0; + locs[TCCF_SLOT] = i; + locs[TCCF_OFFSET] = 0; /* * Attach the device. */ - config_found_sm_loc(self, "tc", ldesc, &ta, + config_found_sm_loc(self, "tc", locs, &ta, tcprint, tcsubmatch); } } @@ -208,18 +205,18 @@ tcprint(aux, pnp) } int -tcsubmatch(parent, cf, ldesc, aux) +tcsubmatch(parent, cf, locs, aux) struct device *parent; struct cfdata *cf; - const locdesc_t *ldesc; + const locdesc_t *locs; void *aux; { if ((cf->cf_loc[TCCF_SLOT] != TCCF_SLOT_DEFAULT) && - (cf->cf_loc[TCCF_SLOT] != ldesc->locs[TCCF_SLOT])) + (cf->cf_loc[TCCF_SLOT] != locs[TCCF_SLOT])) return 0; if ((cf->cf_loc[TCCF_OFFSET] != TCCF_OFFSET_DEFAULT) && - (cf->cf_loc[TCCF_OFFSET] != ldesc->locs[TCCF_OFFSET])) + (cf->cf_loc[TCCF_OFFSET] != locs[TCCF_OFFSET])) return 0; return (config_match(parent, cf, aux)); diff --git a/sys/dev/tc/tcds.c b/sys/dev/tc/tcds.c index edb1dadd555..04caf2e434f 100644 --- a/sys/dev/tc/tcds.c +++ b/sys/dev/tc/tcds.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcds.c,v 1.14 2005/02/27 00:27:49 perry Exp $ */ +/* $NetBSD: tcds.c,v 1.15 2005/08/25 18:35:40 drochner Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tcds.c,v 1.14 2005/02/27 00:27:49 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcds.c,v 1.15 2005/08/25 18:35:40 drochner Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -171,8 +171,7 @@ tcdsattach(parent, self, aux) bus_space_handle_t sbsh[2]; int i, gpi2; const struct evcnt *pevcnt; - int help[2]; - locdesc_t *ldesc = (void *)help; /* XXX */ + int locs[TCDSCF_NLOCS]; td = tcds_lookup(ta->ta_modname); if (td == NULL) @@ -308,10 +307,9 @@ tcdsattach(parent, self, aux) tcds_scsi_reset(tcdsdev.tcdsda_sc); - ldesc->len = 1; - ldesc->locs[TCDSCF_CHIP] = i; + locs[TCDSCF_CHIP] = i; - config_found_sm_loc(self, "tcds", ldesc, &tcdsdev, + config_found_sm_loc(self, "tcds", locs, &tcdsdev, tcdsprint, tcdssubmatch); #ifdef __alpha__ /* @@ -326,15 +324,15 @@ tcdsattach(parent, self, aux) } int -tcdssubmatch(parent, cf, ldesc, aux) +tcdssubmatch(parent, cf, locs, aux) struct device *parent; struct cfdata *cf; - const locdesc_t *ldesc; + const locdesc_t *locs; void *aux; { if (cf->cf_loc[TCDSCF_CHIP] != TCDSCF_CHIP_DEFAULT && - cf->cf_loc[TCDSCF_CHIP] != ldesc->locs[TCDSCF_CHIP]) + cf->cf_loc[TCDSCF_CHIP] != locs[TCDSCF_CHIP]) return (0); return (config_match(parent, cf, aux)); diff --git a/sys/dev/tc/zs_ioasic.c b/sys/dev/tc/zs_ioasic.c index d2094902c4d..086cad8bac3 100644 --- a/sys/dev/tc/zs_ioasic.c +++ b/sys/dev/tc/zs_ioasic.c @@ -1,4 +1,4 @@ -/* $NetBSD: zs_ioasic.c,v 1.26 2005/06/02 13:11:39 drochner Exp $ */ +/* $NetBSD: zs_ioasic.c,v 1.27 2005/08/25 18:35:40 drochner Exp $ */ /*- * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: zs_ioasic.c,v 1.26 2005/06/02 13:11:39 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zs_ioasic.c,v 1.27 2005/08/25 18:35:40 drochner Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -249,8 +249,7 @@ zs_ioasic_attach(parent, self, aux) struct zshan *zc; int s, channel; u_long zflg; - int help[2]; - locdesc_t *ldesc = (void *)help; /* XXX */ + int locs[ZSCCF_NLOCS]; printf("\n"); @@ -319,14 +318,13 @@ zs_ioasic_attach(parent, self, aux) else cs->cs_ctl_chan = NULL; - ldesc->len = 1; - ldesc->locs[ZSCCF_CHANNEL] = channel; + locs[ZSCCF_CHANNEL] = channel; /* * Look for a child driver for this channel. * The child attach will setup the hardware. */ - if (config_found_sm_loc(self, "zsc", ldesc, (void *)&zs_args, + if (config_found_sm_loc(self, "zsc", locs, (void *)&zs_args, zs_ioasic_print, zs_ioasic_submatch) == NULL) { /* No sub-driver. Just reset it. */ u_char reset = (channel == 0) ? @@ -386,10 +384,10 @@ zs_ioasic_print(aux, name) } int -zs_ioasic_submatch(parent, cf, ldesc, aux) +zs_ioasic_submatch(parent, cf, locs, aux) struct device *parent; struct cfdata *cf; - const locdesc_t *ldesc; + const locdesc_t *locs; void *aux; { struct zsc_softc *zs = (void *)parent; @@ -397,7 +395,7 @@ zs_ioasic_submatch(parent, cf, ldesc, aux) const char *defname = ""; if (cf->cf_loc[ZSCCF_CHANNEL] != ZSCCF_CHANNEL_DEFAULT && - cf->cf_loc[ZSCCF_CHANNEL] != ldesc->locs[ZSCCF_CHANNEL]) + cf->cf_loc[ZSCCF_CHANNEL] != locs[ZSCCF_CHANNEL]) return (0); if (cf->cf_loc[ZSCCF_CHANNEL] == ZSCCF_CHANNEL_DEFAULT) { |
