From 49a360989237c55b4155d08a8df817541abfbbf6 Mon Sep 17 00:00:00 2001 From: drochner Date: Fri, 26 Aug 2005 11:20:33 +0000 Subject: [PATCH] kill some more simple submatch() functions, use config_stdsubmatch() --- sys/dev/ieee1394/firewire.c | 18 +----------------- sys/dev/ieee1394/fw_port.h | 15 +++++---------- sys/dev/mca/edc_mca.c | 18 +++--------------- sys/dev/pci/amr.c | 26 +++----------------------- sys/dev/pci/puc.c | 20 +++----------------- sys/dev/pci/twe.c | 23 +++-------------------- sys/dev/pcmcia/pcmcom.c | 23 +++-------------------- 7 files changed, 21 insertions(+), 122 deletions(-) diff --git a/sys/dev/ieee1394/firewire.c b/sys/dev/ieee1394/firewire.c index ef8bee5936dd..e3d91e57ef22 100644 --- a/sys/dev/ieee1394/firewire.c +++ b/sys/dev/ieee1394/firewire.c @@ -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) 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 *); int firewiredetach (struct device *, int); int firewire_print (void *, const char *); -static int firewiresubmatch( - struct device *, struct cfdata *, const locdesc_t *, void *); #endif static void fw_try_bmr (void *); static void fw_try_bmr_callback (struct fw_xfer *); @@ -555,20 +553,6 @@ firewire_resume(device_t dev) 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 /* diff --git a/sys/dev/ieee1394/fw_port.h b/sys/dev/ieee1394/fw_port.h index 829d0d670f57..93b17337a6fa 100644 --- a/sys/dev/ieee1394/fw_port.h +++ b/sys/dev/ieee1394/fw_port.h @@ -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 * All rights reserved. @@ -823,11 +823,7 @@ struct fwbus_attach_args { do { \ struct firewire_softc *sc = (struct firewire_softc *)fc->bdev;\ struct firewire_dev_list *devlist, *elm; \ - struct fw_loc { \ - int len; \ - struct fw_eui64 eui; \ - } help; \ - locdesc_t *ldp = (void *)&help; /* XXX XXX */ \ + int locs[IEEE1394IFCF_NLOCS]; \ \ devlist = malloc( \ sizeof (struct firewire_dev_list), M_DEVBUF, M_NOWAIT); \ @@ -836,13 +832,12 @@ struct fwbus_attach_args { break; \ } \ \ - help.len = sizeof (struct fw_eui64); \ - help.eui.hi = fwdev->eui.hi; \ - help.eui.lo = fwdev->eui.lo; \ + locs[IEEE1394IFCF_EUIHI] = fwdev->eui.hi; \ + locs[IEEE1394IFCF_EUILO] = fwdev->eui.lo; \ \ fwa.fwdev = fwdev; \ fwdev->sbp = config_found_sm_loc(sc->dev, "ieee1394if", \ - ldp, &fwa, firewire_print, firewiresubmatch); \ + locs, &fwa, firewire_print, config_stdsubmatch); \ if (fwdev->sbp == NULL) { \ free(devlist, M_DEVBUF); \ break; \ diff --git a/sys/dev/mca/edc_mca.c b/sys/dev/mca/edc_mca.c index 687af9ae4594..666f8bb5a431 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.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. @@ -50,7 +50,7 @@ */ #include -__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" @@ -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 edc_mca_attach(parent, self, aux) struct device *parent, *self; @@ -326,7 +314,7 @@ edc_mca_attach(parent, self, aux) locs[EDCCF_DRIVE] = devno; sc->sc_ed[devno] = (void *) config_found_sm_loc(self, "edc", locs, &eda, - NULL, edcsubmatch); + NULL, config_stdsubmatch); /* If initialization did not succeed, NULL the pointer. */ if (sc->sc_ed[devno] diff --git a/sys/dev/pci/amr.c b/sys/dev/pci/amr.c index a643d5c5c287..ccadcd0abd1c 100644 --- a/sys/dev/pci/amr.c +++ b/sys/dev/pci/amr.c @@ -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. @@ -71,7 +71,7 @@ */ #include -__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 #include @@ -105,8 +105,6 @@ static int amr_intr(void *); static int amr_match(struct device *, struct cfdata *, void *); static int amr_print(void *, const char *); 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_thread(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; 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); @@ -532,24 +530,6 @@ amr_print(void *aux, const char *pnp) 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. */ diff --git a/sys/dev/pci/puc.c b/sys/dev/pci/puc.c index 630fb0666928..b5a85049f84c 100644 --- a/sys/dev/pci/puc.c +++ b/sys/dev/pci/puc.c @@ -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 @@ -53,7 +53,7 @@ */ #include -__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 #include @@ -96,8 +96,6 @@ struct puc_softc { }; 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); @@ -304,7 +302,7 @@ puc_attach(struct device *parent, struct device *self, void *aux) /* and configure it */ 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); } -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 * puc_find_description(pcireg_t vend, pcireg_t prod, pcireg_t svend, pcireg_t sprod) diff --git a/sys/dev/pci/twe.c b/sys/dev/pci/twe.c index 55d9111a4575..1a07b130a98e 100644 --- a/sys/dev/pci/twe.c +++ b/sys/dev/pci/twe.c @@ -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. @@ -70,7 +70,7 @@ */ #include -__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 #include @@ -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 int twe_print(void *, const char *); 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_wait(struct twe_softc *, u_int, int); 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; td->td_dev = config_found_sm_loc(&sc->sc_dv, "twe", locs, &twea, - twe_print, twe_submatch); + twe_print, config_stdsubmatch); rv = 0; out: @@ -773,21 +771,6 @@ twe_print(void *aux, const char *pnp) 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. */ diff --git a/sys/dev/pcmcia/pcmcom.c b/sys/dev/pcmcia/pcmcom.c index 7952152d7158..a40b1e75dfd7 100644 --- a/sys/dev/pcmcia/pcmcom.c +++ b/sys/dev/pcmcia/pcmcom.c @@ -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. @@ -51,7 +51,7 @@ */ #include -__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 #include @@ -112,8 +112,6 @@ const size_t pcmcom_nproducts = sizeof(pcmcom_products) / sizeof(pcmcom_products[0]); int pcmcom_print(void *, const char *); -int pcmcom_submatch(struct device *, struct cfdata *, - const locdesc_t *, void *); int pcmcom_enable(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, "pcmcom", locs, - &pca, pcmcom_print, pcmcom_submatch); + &pca, pcmcom_print, config_stdsubmatch); } pcmcom_disable(sc); @@ -272,21 +270,6 @@ pcmcom_print(aux, pnp) 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 pcmcom_intr(arg) void *arg;