Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev a round of autoconf cleanup:
details: https://anonhg.NetBSD.org/src/rev/e1d7cba9e494
branches: trunk
changeset: 569912:e1d7cba9e494
user: drochner <drochner%NetBSD.org@localhost>
date: Mon Sep 13 12:55:47 2004 +0000
description:
a round of autoconf cleanup:
-convert submatch() style functions (passed to config_search() or
config_found_sm()) to the locator passing variants
-pass interface attributes in some cases
-make submatch() functions look uniformly as far as possible
-avoid macros which just hide cfdata members, and reduce dependencies
on "locators.h"
diffstat:
sys/dev/ata/ata_raid.c | 24 ++++++++++++++-------
sys/dev/cardbus/cardslot.c | 26 +++++++++++++++--------
sys/dev/cardbus/cardslotvar.h | 4 +--
sys/dev/gpib/cs80bus.c | 10 +++++---
sys/dev/gpib/gpib.c | 18 ++++++++++------
sys/dev/hpc/hpcioman.c | 12 ++++++----
sys/dev/i2c/i2c.c | 7 +++--
sys/dev/i2o/iop.c | 34 +++++++++++++++++++++----------
sys/dev/i2o/iopvar.h | 5 +---
sys/dev/ic/aac.c | 27 ++++++++++++++++--------
sys/dev/ic/aacvar.h | 4 +--
sys/dev/ic/atppc.c | 12 +++++-----
sys/dev/ic/cac.c | 28 ++++++++++++++++---------
sys/dev/ic/cacvar.h | 6 +----
sys/dev/ic/icp.c | 47 +++++++++++++++++++++++++++++-------------
sys/dev/ic/icpvar.h | 6 +----
sys/dev/ic/mlx.c | 27 +++++++++++++++---------
sys/dev/ic/mlxvar.h | 6 +----
sys/dev/ic/upc.c | 30 +++++++++++++++++++++------
sys/dev/ieee1394/fwohci.c | 15 ++++++++-----
sys/dev/isapnp/isapnp.c | 15 ++++++++-----
sys/dev/marvell/gt.c | 9 ++++---
sys/dev/marvell/gtvar.h | 18 +---------------
sys/dev/marvell/obio.c | 14 +++++++-----
sys/dev/mii/mii.c | 25 ++++++++++++++--------
sys/dev/pci/amr.c | 26 ++++++++++++++++-------
sys/dev/pci/amrvar.h | 6 +----
sys/dev/pci/puc.c | 23 +++++++++++++-------
sys/dev/pci/twe.c | 29 ++++++++++++++++----------
sys/dev/pci/twevar.h | 6 +----
sys/dev/pci/viapm.c | 17 ++++----------
sys/dev/pckbport/pckbport.c | 21 ++++++++++++------
sys/dev/pcmcia/pcmciachip.h | 8 +------
sys/dev/pcmcia/pcmcom.c | 25 ++++++++++++++--------
sys/dev/podulebus/acemidi.c | 6 ++--
sys/dev/scsipi/atapiconf.c | 14 +++++++-----
sys/dev/std/ieee1212.c | 6 ++--
sys/dev/tc/tcds.c | 20 ++++++++++++-----
sys/dev/tc/zs_ioasic.c | 20 ++++++++++++-----
sys/dev/usb/ubsa.c | 7 +++--
sys/dev/usb/ucom.c | 13 +++++++----
sys/dev/usb/ucomvar.h | 10 ++++----
sys/dev/usb/uftdi.c | 7 +++--
sys/dev/usb/uhidev.c | 29 ++++++++++++++++++--------
sys/dev/usb/uhidev.h | 7 +-----
sys/dev/usb/umct.c | 7 +++--
sys/dev/usb/umodem.c | 7 +++--
sys/dev/usb/uplcom.c | 7 +++--
sys/dev/usb/usb_port.h | 5 ++-
sys/dev/usb/usb_subr.c | 12 ++++++----
sys/dev/usb/uvisor.c | 13 ++++++-----
sys/dev/usb/uvscom.c | 7 +++--
sys/dev/vme/vme.c | 18 ++++++++++------
53 files changed, 469 insertions(+), 336 deletions(-)
diffs (truncated from 2623 to 300 lines):
diff -r 35dd148a35d7 -r e1d7cba9e494 sys/dev/ata/ata_raid.c
--- a/sys/dev/ata/ata_raid.c Mon Sep 13 12:49:58 2004 +0000
+++ b/sys/dev/ata/ata_raid.c Mon Sep 13 12:55:47 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ata_raid.c,v 1.8 2004/01/25 18:06:48 hannken Exp $ */
+/* $NetBSD: ata_raid.c,v 1.9 2004/09/13 12:55:47 drochner Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.8 2004/01/25 18:06:48 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.9 2004/09/13 12:55:47 drochner Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -75,7 +75,8 @@
static void ataraid_attach(struct device *, struct device *, void *);
static int ataraid_print(void *, const char *);
-static int ataraid_submatch(struct device *, struct cfdata *, void *);
+static int ataraid_submatch(struct device *, struct cfdata *,
+ const locdesc_t *, void *);
static int ata_raid_finalize(struct device *);
@@ -182,6 +183,8 @@
ataraid_attach(struct device *parent, struct device *self, void *aux)
{
struct ataraid_array_info *aai;
+ int help[3];
+ locdesc_t *ldesc = (void *)help; /* XXX */
/*
* We're a pseudo-device, so we get to announce our own
@@ -192,7 +195,12 @@
ataraid_array_info_count == 1 ? "" : "s");
TAILQ_FOREACH(aai, &ataraid_array_info_list, aai_list) {
- config_found_sm(self, aai, ataraid_print, ataraid_submatch);
+ ldesc->len = 2;
+ ldesc->locs[ATARAIDCF_VENDTYPE] = aai->aai_type;
+ ldesc->locs[ATARAIDCF_UNIT] = aai->aai_arrayno;
+
+ config_found_sm_loc(self, "ataraid", NULL, aai,
+ ataraid_print, ataraid_submatch);
}
}
@@ -218,16 +226,16 @@
* Submatch routine for ATA RAID logical disks.
*/
static int
-ataraid_submatch(struct device *parent, struct cfdata *cf, void *aux)
+ataraid_submatch(struct device *parent, struct cfdata *cf,
+ const locdesc_t *ldesc, void *aux)
{
- struct ataraid_array_info *aai = aux;
if (cf->cf_loc[ATARAIDCF_VENDTYPE] != ATARAIDCF_VENDTYPE_DEFAULT &&
- cf->cf_loc[ATARAIDCF_VENDTYPE] != aai->aai_type)
+ cf->cf_loc[ATARAIDCF_VENDTYPE] != ldesc->locs[ATARAIDCF_VENDTYPE])
return (0);
if (cf->cf_loc[ATARAIDCF_UNIT] != ATARAIDCF_UNIT_DEFAULT &&
- cf->cf_loc[ATARAIDCF_UNIT] != aai->aai_arrayno)
+ cf->cf_loc[ATARAIDCF_UNIT] != ldesc->locs[ATARAIDCF_UNIT])
return (0);
return (config_match(parent, cf, aux));
diff -r 35dd148a35d7 -r e1d7cba9e494 sys/dev/cardbus/cardslot.c
--- a/sys/dev/cardbus/cardslot.c Mon Sep 13 12:49:58 2004 +0000
+++ b/sys/dev/cardbus/cardslot.c Mon Sep 13 12:55:47 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cardslot.c,v 1.24 2003/11/02 09:56:38 wiz Exp $ */
+/* $NetBSD: cardslot.c,v 1.25 2004/09/13 12:55:47 drochner Exp $ */
/*
* Copyright (c) 1999 and 2000
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cardslot.c,v 1.24 2003/11/02 09:56:38 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cardslot.c,v 1.25 2004/09/13 12:55:47 drochner Exp $");
#include "opt_cardslot.h"
@@ -53,6 +53,7 @@
#include <dev/pcmcia/pcmciachip.h>
#include <dev/ic/i82365var.h>
+#include "locators.h"
#if defined CARDSLOT_DEBUG
#define STATIC
@@ -72,7 +73,8 @@
STATIC int cardslot_cb_print __P((void *aux, const char *pcic));
static int cardslot_16_print __P((void *, const char *));
-static int cardslot_16_submatch __P((struct device *, struct cfdata *,void *));
+static int cardslot_16_submatch __P((struct device *, struct cfdata *,
+ const locdesc_t *, void *));
CFATTACH_DECL(cardslot, sizeof(struct cardslot_softc),
cardslotmatch, cardslotattach, NULL, NULL);
@@ -116,20 +118,25 @@
SIMPLEQ_INIT(&sc->sc_events);
sc->sc_th_enable = 0;
- printf(" slot %d flags %x\n", sc->sc_slot, sc->sc_dev.dv_cfdata->cf_flags);
+ printf(" slot %d flags %x\n", sc->sc_slot,
+ sc->sc_dev.dv_cfdata->cf_flags);
DPRINTF(("%s attaching CardBus bus...\n", sc->sc_dev.dv_xname));
if (cba != NULL) {
- if (NULL != (csc = (void *)config_found(self, cba, cardslot_cb_print))) {
+ csc = (void *)config_found_ia(self, "cbbus", cba,
+ cardslot_cb_print);
+ if (csc) {
/* cardbus found */
- DPRINTF(("cardslotattach: found cardbus on %s\n", sc->sc_dev.dv_xname));
+ DPRINTF(("cardslotattach: found cardbus on %s\n",
+ sc->sc_dev.dv_xname));
sc->sc_cb_softc = csc;
}
}
if (pa != NULL) {
- if (NULL != (psc = (void *)config_found_sm(self, pa,
- cardslot_16_print, cardslot_16_submatch))) {
+ psc = (void *)config_found_sm_loc(self, "pcmciabus", NULL, pa,
+ cardslot_16_print, cardslot_16_submatch);
+ if (psc) {
/* pcmcia 16-bit bus found */
DPRINTF(("cardslotattach: found 16-bit pcmcia bus\n"));
sc->sc_16_softc = psc;
@@ -178,9 +185,10 @@
static int
-cardslot_16_submatch(parent, cf, aux)
+cardslot_16_submatch(parent, cf, ldesc, aux)
struct device *parent;
struct cfdata *cf;
+ const locdesc_t *ldesc;
void *aux;
{
diff -r 35dd148a35d7 -r e1d7cba9e494 sys/dev/cardbus/cardslotvar.h
--- a/sys/dev/cardbus/cardslotvar.h Mon Sep 13 12:49:58 2004 +0000
+++ b/sys/dev/cardbus/cardslotvar.h Mon Sep 13 12:55:47 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cardslotvar.h,v 1.7 2003/07/08 10:06:29 itojun Exp $ */
+/* $NetBSD: cardslotvar.h,v 1.8 2004/09/13 12:55:47 drochner Exp $ */
/*
* Copyright (c) 1999
@@ -122,8 +122,6 @@
#define IS_CARDSLOT_INSERT_REMOVE_EV(x) (0 <= (x) && (x) <= 3)
-#include "locators.h"
-
void cardslot_event_throw __P((cardslot_t, int));
#endif /* !_DEV_CARDBUS_CARDSLOTVAR_H_ */
diff -r 35dd148a35d7 -r e1d7cba9e494 sys/dev/gpib/cs80bus.c
--- a/sys/dev/gpib/cs80bus.c Mon Sep 13 12:49:58 2004 +0000
+++ b/sys/dev/gpib/cs80bus.c Mon Sep 13 12:55:47 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cs80bus.c,v 1.1 2003/06/02 03:51:04 gmcgarry Exp $ */
+/* $NetBSD: cs80bus.c,v 1.2 2004/09/13 12:55:47 drochner Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cs80bus.c,v 1.1 2003/06/02 03:51:04 gmcgarry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs80bus.c,v 1.2 2004/09/13 12:55:47 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -71,7 +71,8 @@
cs80busmatch, cs80busattach, NULL, NULL);
static int cs80bus_alloc(struct cs80bus_softc *, int, int);
-static int cs80bussearch(struct device *, struct cfdata *, void *);
+static int cs80bussearch(struct device *, struct cfdata *,
+ const locdesc_t *, void *);
static int cs80busprint(void *, const char *);
/*
@@ -141,7 +142,7 @@
ca.ca_slave = slave;
ca.ca_id = id;
- (void)config_search(cs80bussearch, &sc->sc_dev, &ca);
+ (void)config_search_ia(cs80bussearch, &sc->sc_dev, "cs80bus", &ca);
}
}
@@ -149,6 +150,7 @@
cs80bussearch(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
+ const locdesc_t *ldesc;
void *aux;
{
struct cs80bus_softc *sc = (struct cs80bus_softc *)parent;
diff -r 35dd148a35d7 -r e1d7cba9e494 sys/dev/gpib/gpib.c
--- a/sys/dev/gpib/gpib.c Mon Sep 13 12:49:58 2004 +0000
+++ b/sys/dev/gpib/gpib.c Mon Sep 13 12:55:47 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpib.c,v 1.1 2003/06/02 03:45:42 gmcgarry Exp $ */
+/* $NetBSD: gpib.c,v 1.2 2004/09/13 12:55:47 drochner Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gpib.c,v 1.1 2003/06/02 03:45:42 gmcgarry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpib.c,v 1.2 2004/09/13 12:55:47 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -71,8 +71,10 @@
CFATTACH_DECL(gpib, sizeof(struct gpib_softc),
gpibmatch, gpibattach, NULL, NULL);
-static int gpibsubmatch1(struct device *, struct cfdata *, void *);
-static int gpibsubmatch2(struct device *, struct cfdata *, void *);
+static int gpibsubmatch1(struct device *, struct cfdata *,
+ const locdesc_t *, void *);
+static int gpibsubmatch2(struct device *, struct cfdata *,
+ const locdesc_t *, void *);
static int gpibprint(void *, const char *);
dev_type_open(gpibopen);
@@ -139,18 +141,19 @@
for (address=0; address<GPIB_NDEVS; address++) {
ga.ga_ic = sc->sc_ic;
ga.ga_address = address;
- (void) config_search(gpibsubmatch1, &sc->sc_dev, &ga);
+ (void) config_search_ia(gpibsubmatch1, &sc->sc_dev, "gpib", &ga);
}
/* attach the wild-carded devices - probably protocol busses */
ga.ga_ic = sc->sc_ic;
- (void) config_search(gpibsubmatch2, &sc->sc_dev, &ga);
+ (void) config_search_ia(gpibsubmatch2, &sc->sc_dev, "gpib", &ga);
}
int
-gpibsubmatch1(parent, cf, aux)
+gpibsubmatch1(parent, cf, ldesc, aux)
struct device *parent;
struct cfdata *cf;
+ const locdesc_t *ldesc;
void *aux;
{
struct gpib_softc *sc = (struct gpib_softc *)parent;
@@ -175,6 +178,7 @@
gpibsubmatch2(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
+ const locdesc_t *ldesc;
void *aux;
{
struct gpib_attach_args *ga = aux;
diff -r 35dd148a35d7 -r e1d7cba9e494 sys/dev/hpc/hpcioman.c
--- a/sys/dev/hpc/hpcioman.c Mon Sep 13 12:49:58 2004 +0000
+++ b/sys/dev/hpc/hpcioman.c Mon Sep 13 12:55:47 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hpcioman.c,v 1.10 2003/01/01 00:19:31 thorpej Exp $ */
+/* $NetBSD: hpcioman.c,v 1.11 2004/09/13 12:55:47 drochner Exp $ */
/*-
* Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpcioman.c,v 1.10 2003/01/01 00:19:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcioman.c,v 1.11 2004/09/13 12:55:47 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -56,7 +56,8 @@
int hpcioman_match(struct device *, struct cfdata *, void *);
void hpcioman_attach(struct device *, struct device *, void *);
int hpcioman_print(void *, const char *);
-int hpcioman_search(struct device *, struct cfdata *, void *);
+int hpcioman_search(struct device *, struct cfdata *,
Home |
Main Index |
Thread Index |
Old Index