Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Extract a subroutine, const char *cfdata_ifattr(cfdata_t...



details:   https://anonhg.NetBSD.org/src/rev/0adbd6b1825d
branches:  trunk
changeset: 752111:0adbd6b1825d
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Mon Feb 15 20:20:34 2010 +0000

description:
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.

diffstat:

 sys/kern/subr_autoconf.c |  19 ++++++++++++-------
 sys/sys/device.h         |   4 +++-
 2 files changed, 15 insertions(+), 8 deletions(-)

diffs (86 lines):

diff -r b6e8cf7fe877 -r 0adbd6b1825d sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c  Mon Feb 15 12:46:24 2010 +0000
+++ b/sys/kern/subr_autoconf.c  Mon Feb 15 20:20:34 2010 +0000
@@ -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)
 {
diff -r b6e8cf7fe877 -r 0adbd6b1825d sys/sys/device.h
--- a/sys/sys/device.h  Mon Feb 15 12:46:24 2010 +0000
+++ b/sys/sys/device.h  Mon Feb 15 20:20:34 2010 +0000
@@ -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 *);



Home | Main Index | Thread Index | Old Index