diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c index 4ccd31a4bee9..90f6b2e489ed 100644 --- a/sys/dev/cardbus/cardbus.c +++ b/sys/dev/cardbus/cardbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: cardbus.c,v 1.69 2006/03/28 17:38:29 thorpej Exp $ */ +/* $NetBSD: cardbus.c,v 1.70 2006/03/29 06:00:46 thorpej Exp $ */ /* * Copyright (c) 1997, 1998, 1999 and 2000 @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.69 2006/03/28 17:38:29 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.70 2006/03/29 06:00:46 thorpej Exp $"); #include "opt_cardbus.h" @@ -672,7 +672,7 @@ cardbus_childdetached(struct device *self, struct device *child) struct cardbus_softc *sc = (struct cardbus_softc *)self; struct cardbus_devfunc *ct; - ct = sc->sc_funcs[child->dv_locators[CARDBUSCF_FUNCTION]]; + ct = sc->sc_funcs[device_locator(child, CARDBUSCF_FUNCTION)]; KASSERT(ct->ct_device == child); sc->sc_poweron_func &= ~(1 << ct->ct_func); diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 59570bfd0966..7e4e92ab1261 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: pci.c,v 1.97 2005/12/11 12:22:50 christos Exp $ */ +/* $NetBSD: pci.c,v 1.98 2006/03/29 06:00:46 thorpej Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.97 2005/12/11 12:22:50 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.98 2006/03/29 06:00:46 thorpej Exp $"); #include "opt_pci.h" @@ -352,9 +352,8 @@ pcidevdetached(struct device *sc, struct device *dev) struct pci_softc *psc = (struct pci_softc *)sc; int d, f; - KASSERT(dev->dv_locators); - d = dev->dv_locators[PCICF_DEV]; - f = dev->dv_locators[PCICF_FUNCTION]; + d = device_locator(dev, PCICF_DEV); + f = device_locator(dev, PCICF_FUNCTION); KASSERT(psc->PCI_SC_DEVICESC(d, f) == dev); diff --git a/sys/dev/pcmcia/pcmcia.c b/sys/dev/pcmcia/pcmcia.c index 0cf5af1b0c0b..765ff6f5da7f 100644 --- a/sys/dev/pcmcia/pcmcia.c +++ b/sys/dev/pcmcia/pcmcia.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcmcia.c,v 1.78 2005/12/11 12:23:23 christos Exp $ */ +/* $NetBSD: pcmcia.c,v 1.79 2006/03/29 06:00:46 thorpej Exp $ */ /* * Copyright (c) 2004 Charles M. Hannum. All rights reserved. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcmcia.c,v 1.78 2005/12/11 12:23:23 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcmcia.c,v 1.79 2006/03/29 06:00:46 thorpej Exp $"); #include "opt_pcmciaverbose.h" @@ -294,7 +294,7 @@ pcmcia_childdetached(struct device *self, struct device *child) if (SIMPLEQ_EMPTY(&pf->cfe_head)) continue; if (pf->child == child) { - KASSERT(child->dv_locators[PCMCIACF_FUNCTION] + KASSERT(device_locator(child, PCMCIACF_FUNCTION) == pf->number); pf->child = NULL; return; diff --git a/sys/dev/scsipi/scsiconf.c b/sys/dev/scsipi/scsiconf.c index 7961fc331aa8..d3ebadee5879 100644 --- a/sys/dev/scsipi/scsiconf.c +++ b/sys/dev/scsipi/scsiconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsiconf.c,v 1.234 2005/12/11 12:23:50 christos Exp $ */ +/* $NetBSD: scsiconf.c,v 1.235 2006/03/29 06:00:46 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc. @@ -55,7 +55,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.234 2005/12/11 12:23:50 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.235 2006/03/29 06:00:46 thorpej Exp $"); #include #include @@ -399,8 +399,8 @@ scsidevdetached(struct device *sc, struct device *dev) struct scsipi_periph *periph; int target, lun; - target = dev->dv_locators[SCSIBUSCF_TARGET]; - lun = dev->dv_locators[SCSIBUSCF_LUN]; + target = device_locator(dev, SCSIBUSCF_TARGET); + lun = device_locator(dev, SCSIBUSCF_LUN); periph = scsipi_lookup_periph(chan, target, lun); KASSERT(periph->periph_dev == dev); diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c index b1dbe580944f..3cc9dc6a4e90 100644 --- a/sys/kern/subr_autoconf.c +++ b/sys/kern/subr_autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: subr_autoconf.c,v 1.108 2006/02/23 05:48:12 thorpej Exp $ */ +/* $NetBSD: subr_autoconf.c,v 1.109 2006/03/29 06:00:47 thorpej Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.108 2006/02/23 05:48:12 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.109 2006/03/29 06:00:47 thorpej Exp $"); #include "opt_ddb.h" @@ -1613,11 +1613,12 @@ device_is_active(device_t dev) return ((dev->dv_flags & DVF_ACTIVE) != 0); } -int * -device_locators(device_t dev) +int +device_locator(device_t dev, int locnum) { - return (dev->dv_locators); + KASSERT(dev->dv_locators != NULL); + return (dev->dv_locators[locnum]); } /* diff --git a/sys/sys/device.h b/sys/sys/device.h index 188d0dedc289..34b6e168474e 100644 --- a/sys/sys/device.h +++ b/sys/sys/device.h @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.87 2006/02/23 05:48:12 thorpej Exp $ */ +/* $NetBSD: device.h,v 1.88 2006/03/29 06:00:47 thorpej Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -369,7 +369,7 @@ int device_unit(device_t); const char *device_xname(device_t); device_t device_parent(device_t); boolean_t device_is_active(device_t); -int *device_locators(device_t); +int device_locator(device_t, u_int); boolean_t device_is_a(device_t, const char *);