kill some more simple submatch() functions, use config_stdsubmatch()

This commit is contained in:
drochner 2005-08-26 11:20:33 +00:00
parent 49126e9efe
commit 49a3609892
7 changed files with 21 additions and 122 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: firewire.c,v 1.3 2005/08/25 18:35:39 drochner Exp $ */ /* $NetBSD: firewire.c,v 1.4 2005/08/26 11:20:33 drochner Exp $ */
/*- /*-
* Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 2003 Hidetoshi Shimokawa
* Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@ -195,8 +195,6 @@ int firewirematch (struct device *, struct cfdata *, void *);
void firewireattach (struct device *, struct device *, void *); void firewireattach (struct device *, struct device *, void *);
int firewiredetach (struct device *, int); int firewiredetach (struct device *, int);
int firewire_print (void *, const char *); int firewire_print (void *, const char *);
static int firewiresubmatch(
struct device *, struct cfdata *, const locdesc_t *, void *);
#endif #endif
static void fw_try_bmr (void *); static void fw_try_bmr (void *);
static void fw_try_bmr_callback (struct fw_xfer *); static void fw_try_bmr_callback (struct fw_xfer *);
@ -555,20 +553,6 @@ firewire_resume(device_t dev)
return(0); return(0);
} }
#elif defined(__NetBSD__)
static int
firewiresubmatch(
struct device *parent, struct cfdata *cf, const locdesc_t *locs, void *aux)
{
if (cf->cf_loc[IEEE1394IFCF_EUIHI] != IEEE1394IFCF_EUIHI_DEFAULT &&
cf->cf_loc[IEEE1394IFCF_EUIHI] != locs[IEEE1394IFCF_EUIHI])
return (0);
if (cf->cf_loc[IEEE1394IFCF_EUILO] != IEEE1394IFCF_EUILO_DEFAULT &&
cf->cf_loc[IEEE1394IFCF_EUILO] != locs[IEEE1394IFCF_EUILO])
return (0);
return (config_match(parent, cf, aux));
}
#endif #endif
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: fw_port.h,v 1.3 2005/07/23 16:55:13 kiyohara Exp $ */ /* $NetBSD: fw_port.h,v 1.4 2005/08/26 11:20:33 drochner Exp $ */
/* /*
* Copyright (c) 2004 KIYOHARA Takashi * Copyright (c) 2004 KIYOHARA Takashi
* All rights reserved. * All rights reserved.
@ -823,11 +823,7 @@ struct fwbus_attach_args {
do { \ do { \
struct firewire_softc *sc = (struct firewire_softc *)fc->bdev;\ struct firewire_softc *sc = (struct firewire_softc *)fc->bdev;\
struct firewire_dev_list *devlist, *elm; \ struct firewire_dev_list *devlist, *elm; \
struct fw_loc { \ int locs[IEEE1394IFCF_NLOCS]; \
int len; \
struct fw_eui64 eui; \
} help; \
locdesc_t *ldp = (void *)&help; /* XXX XXX */ \
\ \
devlist = malloc( \ devlist = malloc( \
sizeof (struct firewire_dev_list), M_DEVBUF, M_NOWAIT); \ sizeof (struct firewire_dev_list), M_DEVBUF, M_NOWAIT); \
@ -836,13 +832,12 @@ struct fwbus_attach_args {
break; \ break; \
} \ } \
\ \
help.len = sizeof (struct fw_eui64); \ locs[IEEE1394IFCF_EUIHI] = fwdev->eui.hi; \
help.eui.hi = fwdev->eui.hi; \ locs[IEEE1394IFCF_EUILO] = fwdev->eui.lo; \
help.eui.lo = fwdev->eui.lo; \
\ \
fwa.fwdev = fwdev; \ fwa.fwdev = fwdev; \
fwdev->sbp = config_found_sm_loc(sc->dev, "ieee1394if", \ fwdev->sbp = config_found_sm_loc(sc->dev, "ieee1394if", \
ldp, &fwa, firewire_print, firewiresubmatch); \ locs, &fwa, firewire_print, config_stdsubmatch); \
if (fwdev->sbp == NULL) { \ if (fwdev->sbp == NULL) { \
free(devlist, M_DEVBUF); \ free(devlist, M_DEVBUF); \
break; \ break; \

View File

@ -1,4 +1,4 @@
/* $NetBSD: edc_mca.c,v 1.29 2005/08/25 18:35:39 drochner Exp $ */ /* $NetBSD: edc_mca.c,v 1.30 2005/08/26 11:20:33 drochner Exp $ */
/* /*
* Copyright (c) 2001 The NetBSD Foundation, Inc. * Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -50,7 +50,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.29 2005/08/25 18:35:39 drochner Exp $"); __KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.30 2005/08/26 11:20:33 drochner Exp $");
#include "rnd.h" #include "rnd.h"
@ -151,18 +151,6 @@ edc_mca_probe(parent, match, aux)
} }
} }
static int
edcsubmatch(struct device *parent, struct cfdata *cf,
const locdesc_t *locs, void *aux)
{
if (cf->cf_loc[EDCCF_DRIVE] != EDCCF_DRIVE_DEFAULT &&
cf->cf_loc[EDCCF_DRIVE] != locs[EDCCF_DRIVE])
return (0);
return (config_match(parent, cf, aux));
}
void void
edc_mca_attach(parent, self, aux) edc_mca_attach(parent, self, aux)
struct device *parent, *self; struct device *parent, *self;
@ -326,7 +314,7 @@ edc_mca_attach(parent, self, aux)
locs[EDCCF_DRIVE] = devno; locs[EDCCF_DRIVE] = devno;
sc->sc_ed[devno] = sc->sc_ed[devno] =
(void *) config_found_sm_loc(self, "edc", locs, &eda, (void *) config_found_sm_loc(self, "edc", locs, &eda,
NULL, edcsubmatch); NULL, config_stdsubmatch);
/* If initialization did not succeed, NULL the pointer. */ /* If initialization did not succeed, NULL the pointer. */
if (sc->sc_ed[devno] if (sc->sc_ed[devno]

View File

@ -1,4 +1,4 @@
/* $NetBSD: amr.c,v 1.28 2005/08/25 18:35:39 drochner Exp $ */ /* $NetBSD: amr.c,v 1.29 2005/08/26 11:20:33 drochner Exp $ */
/*- /*-
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.28 2005/08/25 18:35:39 drochner Exp $"); __KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.29 2005/08/26 11:20:33 drochner Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -105,8 +105,6 @@ static int amr_intr(void *);
static int amr_match(struct device *, struct cfdata *, void *); static int amr_match(struct device *, struct cfdata *, void *);
static int amr_print(void *, const char *); static int amr_print(void *, const char *);
static void amr_shutdown(void *); static void amr_shutdown(void *);
static int amr_submatch(struct device *, struct cfdata *,
const locdesc_t *, void *);
static void amr_teardown(struct amr_softc *); static void amr_teardown(struct amr_softc *);
static void amr_thread(void *); static void amr_thread(void *);
static void amr_thread_create(void *); static void amr_thread_create(void *);
@ -466,7 +464,7 @@ amr_attach(struct device *parent, struct device *self, void *aux)
locs[AMRCF_UNIT] = j; locs[AMRCF_UNIT] = j;
amr->amr_drive[j].al_dv = config_found_sm_loc(&amr->amr_dv, amr->amr_drive[j].al_dv = config_found_sm_loc(&amr->amr_dv,
"amr", locs, &amra, amr_print, amr_submatch); "amr", locs, &amra, amr_print, config_stdsubmatch);
} }
SIMPLEQ_INIT(&amr->amr_ccb_queue); SIMPLEQ_INIT(&amr->amr_ccb_queue);
@ -532,24 +530,6 @@ amr_print(void *aux, const char *pnp)
return (UNCONF); return (UNCONF);
} }
/*
* Match a sub-device.
*/
static int
amr_submatch(struct device *parent, struct cfdata *cf,
const locdesc_t *locs, void *aux)
{
struct amr_attach_args *amra;
amra = (struct amr_attach_args *)aux;
if (cf->cf_loc[AMRCF_UNIT] != AMRCF_UNIT_DEFAULT &&
cf->cf_loc[AMRCF_UNIT] != locs[AMRCF_UNIT])
return (0);
return (config_match(parent, cf, aux));
}
/* /*
* Retrieve operational parameters and describe the controller. * Retrieve operational parameters and describe the controller.
*/ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: puc.c,v 1.25 2005/08/25 18:35:39 drochner Exp $ */ /* $NetBSD: puc.c,v 1.26 2005/08/26 11:20:33 drochner Exp $ */
/* /*
* Copyright (c) 1996, 1998, 1999 * Copyright (c) 1996, 1998, 1999
@ -53,7 +53,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: puc.c,v 1.25 2005/08/25 18:35:39 drochner Exp $"); __KERNEL_RCSID(0, "$NetBSD: puc.c,v 1.26 2005/08/26 11:20:33 drochner Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -96,8 +96,6 @@ struct puc_softc {
}; };
static int puc_print(void *, const char *); static int puc_print(void *, const char *);
static int puc_submatch(struct device *, struct cfdata *,
const locdesc_t *, void *);
static const char *puc_port_type_name(int); static const char *puc_port_type_name(int);
@ -304,7 +302,7 @@ puc_attach(struct device *parent, struct device *self, void *aux)
/* and configure it */ /* and configure it */
sc->sc_ports[i].dev = config_found_sm_loc(self, "puc", locs, sc->sc_ports[i].dev = config_found_sm_loc(self, "puc", locs,
&paa, puc_print, puc_submatch); &paa, puc_print, config_stdsubmatch);
} }
} }
@ -322,18 +320,6 @@ puc_print(void *aux, const char *pnp)
return (UNCONF); return (UNCONF);
} }
static int
puc_submatch(struct device *parent, struct cfdata *cf,
const locdesc_t *locs, void *aux)
{
if (cf->cf_loc[PUCCF_PORT] != PUCCF_PORT_DEFAULT &&
cf->cf_loc[PUCCF_PORT] != locs[PUCCF_PORT])
return 0;
return (config_match(parent, cf, aux));
}
const struct puc_device_description * const struct puc_device_description *
puc_find_description(pcireg_t vend, pcireg_t prod, pcireg_t svend, puc_find_description(pcireg_t vend, pcireg_t prod, pcireg_t svend,
pcireg_t sprod) pcireg_t sprod)

View File

@ -1,4 +1,4 @@
/* $NetBSD: twe.c,v 1.69 2005/08/25 18:35:39 drochner Exp $ */ /* $NetBSD: twe.c,v 1.70 2005/08/26 11:20:33 drochner Exp $ */
/*- /*-
* Copyright (c) 2000, 2001, 2002, 2003, 2004 The NetBSD Foundation, Inc. * Copyright (c) 2000, 2001, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@ -70,7 +70,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.69 2005/08/25 18:35:39 drochner Exp $"); __KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.70 2005/08/26 11:20:33 drochner Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -115,8 +115,6 @@ static int twe_param_set(struct twe_softc *, int, int, size_t, void *);
static void twe_poll(struct twe_softc *); static void twe_poll(struct twe_softc *);
static int twe_print(void *, const char *); static int twe_print(void *, const char *);
static int twe_reset(struct twe_softc *); static int twe_reset(struct twe_softc *);
static int twe_submatch(struct device *, struct cfdata *,
const locdesc_t *, void *);
static int twe_status_check(struct twe_softc *, u_int); static int twe_status_check(struct twe_softc *, u_int);
static int twe_status_wait(struct twe_softc *, u_int, int); static int twe_status_wait(struct twe_softc *, u_int, int);
static void twe_describe_controller(struct twe_softc *); static void twe_describe_controller(struct twe_softc *);
@ -642,7 +640,7 @@ twe_add_unit(struct twe_softc *sc, int unit)
locs[TWECF_UNIT] = unit; locs[TWECF_UNIT] = unit;
td->td_dev = config_found_sm_loc(&sc->sc_dv, "twe", locs, &twea, td->td_dev = config_found_sm_loc(&sc->sc_dv, "twe", locs, &twea,
twe_print, twe_submatch); twe_print, config_stdsubmatch);
rv = 0; rv = 0;
out: out:
@ -773,21 +771,6 @@ twe_print(void *aux, const char *pnp)
return (UNCONF); return (UNCONF);
} }
/*
* Match a sub-device.
*/
static int
twe_submatch(struct device *parent, struct cfdata *cf,
const locdesc_t *locs, void *aux)
{
if (cf->cf_loc[TWECF_UNIT] != TWECF_UNIT_DEFAULT &&
cf->cf_loc[TWECF_UNIT] != locs[TWECF_UNIT])
return (0);
return (config_match(parent, cf, aux));
}
/* /*
* Interrupt service routine. * Interrupt service routine.
*/ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcmcom.c,v 1.23 2005/08/25 18:35:39 drochner Exp $ */ /* $NetBSD: pcmcom.c,v 1.24 2005/08/26 11:20:34 drochner Exp $ */
/*- /*-
* Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
@ -51,7 +51,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pcmcom.c,v 1.23 2005/08/25 18:35:39 drochner Exp $"); __KERNEL_RCSID(0, "$NetBSD: pcmcom.c,v 1.24 2005/08/26 11:20:34 drochner Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -112,8 +112,6 @@ const size_t pcmcom_nproducts =
sizeof(pcmcom_products) / sizeof(pcmcom_products[0]); sizeof(pcmcom_products) / sizeof(pcmcom_products[0]);
int pcmcom_print(void *, const char *); int pcmcom_print(void *, const char *);
int pcmcom_submatch(struct device *, struct cfdata *,
const locdesc_t *, void *);
int pcmcom_enable(struct pcmcom_softc *); int pcmcom_enable(struct pcmcom_softc *);
void pcmcom_disable(struct pcmcom_softc *); void pcmcom_disable(struct pcmcom_softc *);
@ -186,7 +184,7 @@ pcmcom_attach(parent, self, aux)
sc->sc_slaves[slave] = config_found_sm_loc(&sc->sc_dev, sc->sc_slaves[slave] = config_found_sm_loc(&sc->sc_dev,
"pcmcom", locs, "pcmcom", locs,
&pca, pcmcom_print, pcmcom_submatch); &pca, pcmcom_print, config_stdsubmatch);
} }
pcmcom_disable(sc); pcmcom_disable(sc);
@ -272,21 +270,6 @@ pcmcom_print(aux, pnp)
return (UNCONF); return (UNCONF);
} }
int
pcmcom_submatch(parent, cf, locs, aux)
struct device *parent;
struct cfdata *cf;
const locdesc_t *locs;
void *aux;
{
if (cf->cf_loc[PCMCOMCF_SLAVE] != PCMCOMCF_SLAVE_DEFAULT &&
cf->cf_loc[PCMCOMCF_SLAVE] != locs[PCMCOMCF_SLAVE]);
return (0);
return (config_match(parent, cf, aux));
}
int int
pcmcom_intr(arg) pcmcom_intr(arg)
void *arg; void *arg;