Replace device_locators() with device_locator(), and use it.

This commit is contained in:
thorpej 2006-03-29 06:00:46 +00:00
parent 9dfa94e2e6
commit 78ffd948be
6 changed files with 22 additions and 22 deletions

View File

@ -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 <sys/cdefs.h>
__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);

View File

@ -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 <sys/cdefs.h>
__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);

View File

@ -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 <sys/cdefs.h>
__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;

View File

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/systm.h>
@ -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);

View File

@ -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 <sys/cdefs.h>
__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]);
}
/*

View File

@ -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 *);