Module Name: src Committed By: dyoung Date: Mon Feb 15 20:20:34 UTC 2010
Modified Files: src/sys/kern: subr_autoconf.c src/sys/sys: device.h Log Message: Extract a subroutine, const char *cfdata_ifattr(cfdata_t cf), that returns the name of the interface attribute that associates cf with its parent. Use cfdata_ifattr() at several sites in the autoconf code. To generate a diff of this commit: cvs rdiff -u -r1.200 -r1.201 src/sys/kern/subr_autoconf.c cvs rdiff -u -r1.133 -r1.134 src/sys/sys/device.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/subr_autoconf.c diff -u src/sys/kern/subr_autoconf.c:1.200 src/sys/kern/subr_autoconf.c:1.201 --- src/sys/kern/subr_autoconf.c:1.200 Sun Jan 31 15:10:12 2010 +++ src/sys/kern/subr_autoconf.c Mon Feb 15 20:20:34 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_autoconf.c,v 1.200 2010/01/31 15:10:12 pooka Exp $ */ +/* $NetBSD: subr_autoconf.c,v 1.201 2010/02/15 20:20:34 dyoung 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.200 2010/01/31 15:10:12 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.201 2010/02/15 20:20:34 dyoung Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -537,7 +537,7 @@ const struct cflocdesc *cl; int nlocs, i; - ci = cfiattr_lookup(cf->cf_pspec->cfp_iattr, parent->dv_cfdriver); + ci = cfiattr_lookup(cfdata_ifattr(cf), parent->dv_cfdriver); KASSERT(ci); nlocs = ci->ci_loclen; KASSERT(!nlocs || locs); @@ -669,7 +669,7 @@ continue; (*d->dv_cfattach->ca_rescan)(d, - cf1->cf_pspec->cfp_iattr, cf1->cf_loc); + cfdata_ifattr(cf1), cf1->cf_loc); } } deviter_release(&di); @@ -817,7 +817,7 @@ * consider only children which attach to * that attribute. */ - if (ifattr && !STREQ(ifattr, cf->cf_pspec->cfp_iattr)) + if (ifattr && !STREQ(ifattr, cfdata_ifattr(cf))) continue; if (cfparent_match(parent, cf->cf_pspec)) @@ -1220,8 +1220,7 @@ dev->dv_flags |= ca->ca_flags; /* inherit flags from class */ if (locs) { KASSERT(parent); /* no locators at root */ - ia = cfiattr_lookup(cf->cf_pspec->cfp_iattr, - parent->dv_cfdriver); + ia = cfiattr_lookup(cfdata_ifattr(cf), parent->dv_cfdriver); dev->dv_locators = kmem_alloc(sizeof(int [ia->ci_loclen + 1]), KM_SLEEP); *dev->dv_locators++ = sizeof(int [ia->ci_loclen + 1]); @@ -2587,6 +2586,12 @@ config_alldevs_unlock(s); } +const char * +cfdata_ifattr(const struct cfdata *cf) +{ + return cf->cf_pspec->cfp_iattr; +} + bool ifattr_match(const char *snull, const char *t) { Index: src/sys/sys/device.h diff -u src/sys/sys/device.h:1.133 src/sys/sys/device.h:1.134 --- src/sys/sys/device.h:1.133 Sat Jan 30 11:57:18 2010 +++ src/sys/sys/device.h Mon Feb 15 20:20:34 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.133 2010/01/30 11:57:18 mlelstv Exp $ */ +/* $NetBSD: device.h,v 1.134 2010/02/15 20:20:34 dyoung Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -446,6 +446,8 @@ struct cfattach *config_cfattach_lookup(const char *, const char *); const struct cfiattrdata *cfiattr_lookup(const char *, const struct cfdriver *); +const char *cfdata_ifattr(const struct cfdata *); + int config_stdsubmatch(device_t, cfdata_t, const int *, void *); cfdata_t config_search_loc(cfsubmatch_t, device_t, const char *, const int *, void *);