diff options
author | 2013-11-27 00:00:53 +0000 | |
---|---|---|
committer | 2013-11-27 00:00:53 +0000 | |
commit | 4635878dd7743f1409d06b10988497115577dd52 (patch) | |
tree | 850fcff6ecfb99fdb107935187aa8fed320d06b1 | |
parent | unsigned char for ctype (diff) | |
download | wireguard-openbsd-4635878dd7743f1409d06b10988497115577dd52.tar.xz wireguard-openbsd-4635878dd7743f1409d06b10988497115577dd52.zip |
get rid of the goop for maintaining multiple cftables since theres
no current code there to add or remove them. such code was put in
17 years ago, disabled 14 years ago, and removed 11 years ago, so
i suspect we dont really need it or the goop to support it.
very ok miod@
-rw-r--r-- | sys/kern/subr_autoconf.c | 101 | ||||
-rw-r--r-- | sys/sys/device.h | 8 |
2 files changed, 45 insertions, 64 deletions
diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c index f764445a2d5..7f09cfea5c3 100644 --- a/sys/kern/subr_autoconf.c +++ b/sys/kern/subr_autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_autoconf.c,v 1.69 2013/11/26 11:45:48 dlg Exp $ */ +/* $OpenBSD: subr_autoconf.c,v 1.70 2013/11/27 00:00:53 dlg Exp $ */ /* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */ /* @@ -74,12 +74,6 @@ struct matchinfo { int indirect, pri; }; -struct cftable_head allcftables; - -static struct cftable staticcftable = { - cfdata -}; - #ifndef AUTOCONF_VERBOSE #define AUTOCONF_VERBOSE 0 #endif /* AUTOCONF_VERBOSE */ @@ -119,8 +113,6 @@ config_init(void) { TAILQ_INIT(&deferred_config_queue); TAILQ_INIT(&alldevs); - TAILQ_INIT(&allcftables); - TAILQ_INSERT_TAIL(&allcftables, &staticcftable, list); } /* @@ -186,7 +178,6 @@ config_search(cfmatch_t fn, struct device *parent, void *aux) struct cfdata *cf; short *p; struct matchinfo m; - struct cftable *t; m.fn = fn; m.parent = parent; @@ -194,23 +185,23 @@ config_search(cfmatch_t fn, struct device *parent, void *aux) m.aux = aux; m.indirect = parent && parent->dv_cfdata->cf_driver->cd_indirect; m.pri = 0; - TAILQ_FOREACH(t, &allcftables, list) { - for (cf = t->tab; cf->cf_driver; cf++) { - /* - * Skip cf if no longer eligible, otherwise scan - * through parents for one matching `parent', - * and try match function. - */ - if (cf->cf_fstate == FSTATE_FOUND) - continue; - if (cf->cf_fstate == FSTATE_DNOTFOUND || - cf->cf_fstate == FSTATE_DSTAR) - continue; - for (p = cf->cf_parents; *p >= 0; p++) - if (parent->dv_cfdata == &(t->tab)[*p]) - mapply(&m, cf); - } + + for (cf = cfdata; cf->cf_driver; cf++) { + /* + * Skip cf if no longer eligible, otherwise scan + * through parents for one matching `parent', + * and try match function. + */ + if (cf->cf_fstate == FSTATE_FOUND) + continue; + if (cf->cf_fstate == FSTATE_DNOTFOUND || + cf->cf_fstate == FSTATE_DSTAR) + continue; + for (p = cf->cf_parents; *p >= 0; p++) + if (parent->dv_cfdata == &cfdata[*p]) + mapply(&m, cf); } + if (autoconf_verbose) { if (m.match) { if (m.indirect) @@ -240,29 +231,27 @@ config_scan(cfscan_t fn, struct device *parent) short *p; void *match; int indirect; - struct cftable *t; indirect = parent && parent->dv_cfdata->cf_driver->cd_indirect; - TAILQ_FOREACH(t, &allcftables, list) { - for (cf = t->tab; cf->cf_driver; cf++) { - /* - * Skip cf if no longer eligible, otherwise scan - * through parents for one matching `parent', - * and try match function. - */ - if (cf->cf_fstate == FSTATE_FOUND) - continue; - if (cf->cf_fstate == FSTATE_DNOTFOUND || - cf->cf_fstate == FSTATE_DSTAR) - continue; - for (p = cf->cf_parents; *p >= 0; p++) - if (parent->dv_cfdata == &(t->tab)[*p]) { - match = indirect? - config_make_softc(parent, cf) : - (void *)cf; - (*fn)(parent, match); - } - } + + for (cf = cfdata; cf->cf_driver; cf++) { + /* + * Skip cf if no longer eligible, otherwise scan + * through parents for one matching `parent', + * and try match function. + */ + if (cf->cf_fstate == FSTATE_FOUND) + continue; + if (cf->cf_fstate == FSTATE_DNOTFOUND || + cf->cf_fstate == FSTATE_DSTAR) + continue; + for (p = cf->cf_parents; *p >= 0; p++) + if (parent->dv_cfdata == &cfdata[*p]) { + match = indirect? + config_make_softc(parent, cf) : + (void *)cf; + (*fn)(parent, match); + } } } @@ -346,7 +335,6 @@ config_attach(struct device *parent, void *match, void *aux, cfprint_t print) struct device *dev; struct cfdriver *cd; struct cfattach *ca; - struct cftable *t; mtx_enter(&autoconf_attdet_mtx); while (autoconf_attdet < 0) @@ -397,15 +385,14 @@ config_attach(struct device *parent, void *match, void *aux, cfprint_t print) * otherwise identical, or bump the unit number on all starred * cfdata for this device. */ - TAILQ_FOREACH(t, &allcftables, list) { - for (cf = t->tab; cf->cf_driver; cf++) - if (cf->cf_driver == cd && - cf->cf_unit == dev->dv_unit) { - if (cf->cf_fstate == FSTATE_NOTFOUND) - cf->cf_fstate = FSTATE_FOUND; - if (cf->cf_fstate == FSTATE_STAR) - cf->cf_unit++; - } + for (cf = cfdata; cf->cf_driver; cf++) { + if (cf->cf_driver == cd && + cf->cf_unit == dev->dv_unit) { + if (cf->cf_fstate == FSTATE_NOTFOUND) + cf->cf_fstate = FSTATE_FOUND; + if (cf->cf_fstate == FSTATE_STAR) + cf->cf_unit++; + } } device_register(dev, aux); (*ca->ca_attach)(parent, dev, aux); diff --git a/sys/sys/device.h b/sys/sys/device.h index 8ef70a0191f..e91955521b0 100644 --- a/sys/sys/device.h +++ b/sys/sys/device.h @@ -1,4 +1,4 @@ -/* $OpenBSD: device.h,v 1.45 2012/10/08 21:47:51 deraadt Exp $ */ +/* $OpenBSD: device.h,v 1.46 2013/11/27 00:00:53 dlg Exp $ */ /* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */ /* @@ -163,12 +163,6 @@ struct pdevinit { }; #ifdef _KERNEL -struct cftable { - struct cfdata *tab; - TAILQ_ENTRY(cftable) list; -}; -TAILQ_HEAD(cftable_head, cftable); - extern struct devicelist alldevs; /* list of all devices */ extern int autoconf_verbose; |