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/mca | |
| 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/mca')
| -rw-r--r-- | sys/dev/mca/edc_mca.c | 16 | ||||
| -rw-r--r-- | sys/dev/mca/mca.c | 18 |
2 files changed, 15 insertions, 19 deletions
diff --git a/sys/dev/mca/edc_mca.c b/sys/dev/mca/edc_mca.c index 62a8c2ee2e4..687af9ae459 100644 --- a/sys/dev/mca/edc_mca.c +++ b/sys/dev/mca/edc_mca.c @@ -1,4 +1,4 @@ -/* $NetBSD: edc_mca.c,v 1.28 2005/02/27 00:27:21 perry Exp $ */ +/* $NetBSD: edc_mca.c,v 1.29 2005/08/25 18:35:39 drochner Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.28 2005/02/27 00:27:21 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.29 2005/08/25 18:35:39 drochner Exp $"); #include "rnd.h" @@ -153,11 +153,11 @@ edc_mca_probe(parent, match, aux) static int edcsubmatch(struct device *parent, struct cfdata *cf, - const locdesc_t *ldesc, void *aux) + const locdesc_t *locs, void *aux) { if (cf->cf_loc[EDCCF_DRIVE] != EDCCF_DRIVE_DEFAULT && - cf->cf_loc[EDCCF_DRIVE] != ldesc->locs[EDCCF_DRIVE]) + cf->cf_loc[EDCCF_DRIVE] != locs[EDCCF_DRIVE]) return (0); return (config_match(parent, cf, aux)); @@ -175,8 +175,7 @@ edc_mca_attach(parent, self, aux) int irq, drq, iobase; const char *typestr; int devno, error; - int help[2]; - locdesc_t *ldesc = (void *)help; /* XXX */ + int locs[EDCCF_NLOCS]; pos2 = mca_conf_read(ma->ma_mc, ma->ma_slot, 2); pos3 = mca_conf_read(ma->ma_mc, ma->ma_slot, 3); @@ -324,10 +323,9 @@ edc_mca_attach(parent, self, aux) /* check for attached disks */ for (devno = 0; devno < sc->sc_maxdevs; devno++) { eda.edc_drive = devno; - ldesc->len = 1; - ldesc->locs[EDCCF_DRIVE] = devno; + locs[EDCCF_DRIVE] = devno; sc->sc_ed[devno] = - (void *) config_found_sm_loc(self, "edc", ldesc, &eda, + (void *) config_found_sm_loc(self, "edc", locs, &eda, NULL, edcsubmatch); /* If initialization did not succeed, NULL the pointer. */ diff --git a/sys/dev/mca/mca.c b/sys/dev/mca/mca.c index caec15560d8..c5e13933524 100644 --- a/sys/dev/mca/mca.c +++ b/sys/dev/mca/mca.c @@ -1,4 +1,4 @@ -/* $NetBSD: mca.c,v 1.17 2005/02/04 02:10:43 perry Exp $ */ +/* $NetBSD: mca.c,v 1.18 2005/08/25 18:35:39 drochner Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mca.c,v 1.17 2005/02/04 02:10:43 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mca.c,v 1.18 2005/08/25 18:35:39 drochner Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -118,15 +118,15 @@ mca_print(aux, pnp) } int -mca_submatch(parent, cf, ldesc, aux) +mca_submatch(parent, cf, locs, aux) struct device *parent; struct cfdata *cf; - const locdesc_t *ldesc; + const locdesc_t *locs; void *aux; { if (cf->cf_loc[MCACF_SLOT] != MCACF_SLOT_DEFAULT && - cf->cf_loc[MCACF_SLOT] != ldesc->locs[MCACF_SLOT]) + cf->cf_loc[MCACF_SLOT] != locs[MCACF_SLOT]) return 0; return (config_match(parent, cf, aux)); } @@ -162,8 +162,7 @@ mca_attach(parent, self, aux) for (slot = 0; slot < MCA_MAX_SLOTS; slot++) { struct mca_attach_args ma; int reg; - int help[2]; - locdesc_t *ldesc = (void *)help; /* XXX */ + int locs[MCACF_NLOCS]; ma.ma_iot = iot; ma.ma_memt = memt; @@ -178,12 +177,11 @@ mca_attach(parent, self, aux) if (ma.ma_id == 0xffff) /* no adapter here */ continue; - ldesc->len = 1; - ldesc->locs[MCACF_SLOT] = slot; + locs[MCACF_SLOT] = slot; if (ma.ma_pos[2] & MCA_POS2_ENABLE || mca_match_disabled(ma.ma_id)) - config_found_sm_loc(self, "mca", ldesc, &ma, + config_found_sm_loc(self, "mca", locs, &ma, mca_print, mca_submatch); else { mca_print(&ma, self->dv_xname); |
