Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Don't use SYSCTL_SETUP in a driver.



details:   https://anonhg.NetBSD.org/src/rev/521afc636e01
branches:  trunk
changeset: 760615:521afc636e01
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sun Jan 09 13:01:03 2011 +0000

description:
Don't use SYSCTL_SETUP in a driver.

diffstat:

 sys/dev/pci/if_bge.c    |  23 +++++++++++++----------
 sys/dev/pci/if_bgevar.h |   4 +++-
 2 files changed, 16 insertions(+), 11 deletions(-)

diffs (93 lines):

diff -r 68b4eb8d9688 -r 521afc636e01 sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Sun Jan 09 12:22:34 2011 +0000
+++ b/sys/dev/pci/if_bge.c      Sun Jan 09 13:01:03 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.189 2011/01/05 14:55:10 sketch Exp $      */
+/*     $NetBSD: if_bge.c,v 1.190 2011/01/09 13:01:03 jruoho Exp $      */
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.189 2011/01/05 14:55:10 sketch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.190 2011/01/09 13:01:03 jruoho Exp $");
 
 #include "vlan.h"
 #include "rnd.h"
@@ -261,6 +261,8 @@
 static void bge_stop_fw(struct bge_softc *);
 static int bge_reset(struct bge_softc *);
 static void bge_link_upd(struct bge_softc *);
+static void sysctl_bge_init(struct bge_softc *);
+static int sysctl_bge_verify(SYSCTLFN_PROTO);
 
 #ifdef BGE_DEBUG
 #define DPRINTF(x)     if (bgedebug) printf x
@@ -3044,6 +3046,8 @@
        else
                aprint_error_dev(self, "couldn't establish power handler\n");
 
+       sysctl_bge_init(sc);
+
 #ifdef BGE_DEBUG
        bge_debug_info(sc);
 #endif
@@ -4827,22 +4831,21 @@
 
 /*
  * Set up sysctl(3) MIB, hw.bge.*.
- *
- * TBD condition SYSCTL_PERMANENT on being an LKM or not
  */
-SYSCTL_SETUP(sysctl_bge, "sysctl bge subtree setup")
+static void
+sysctl_bge_init(struct bge_softc *sc)
 {
        int rc, bge_root_num;
        const struct sysctlnode *node;
 
-       if ((rc = sysctl_createv(clog, 0, NULL, NULL,
+       if ((rc = sysctl_createv(&sc->bge_log, 0, NULL, NULL,
            CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw", NULL,
            NULL, 0, NULL, 0, CTL_HW, CTL_EOL)) != 0) {
                goto err;
        }
 
-       if ((rc = sysctl_createv(clog, 0, NULL, &node,
-           CTLFLAG_PERMANENT, CTLTYPE_NODE, "bge",
+       if ((rc = sysctl_createv(&sc->bge_log, 0, NULL, &node,
+           0, CTLTYPE_NODE, "bge",
            SYSCTL_DESCR("BGE interface controls"),
            NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL)) != 0) {
                goto err;
@@ -4851,8 +4854,8 @@
        bge_root_num = node->sysctl_num;
 
        /* BGE Rx interrupt mitigation level */
-       if ((rc = sysctl_createv(clog, 0, NULL, &node,
-           CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+       if ((rc = sysctl_createv(&sc->bge_log, 0, NULL, &node,
+           CTLFLAG_READWRITE,
            CTLTYPE_INT, "rx_lvl",
            SYSCTL_DESCR("BGE receive interrupt mitigation level"),
            sysctl_bge_verify, 0,
diff -r 68b4eb8d9688 -r 521afc636e01 sys/dev/pci/if_bgevar.h
--- a/sys/dev/pci/if_bgevar.h   Sun Jan 09 12:22:34 2011 +0000
+++ b/sys/dev/pci/if_bgevar.h   Sun Jan 09 13:01:03 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bgevar.h,v 1.5 2010/02/03 15:37:51 msaitoh Exp $    */
+/*     $NetBSD: if_bgevar.h,v 1.6 2011/01/09 13:01:03 jruoho Exp $     */
 /*
  * Copyright (c) 2001 Wind River Systems
  * Copyright (c) 1997, 1998, 1999, 2001
@@ -287,6 +287,8 @@
        SLIST_HEAD(, txdmamap_pool_entry) txdma_list;
        struct txdmamap_pool_entry *txdma[BGE_TX_RING_CNT];
 
+       struct sysctllog        *bge_log;
+
 #if NRND > 0
        rndsource_element_t     rnd_source;     /* random source */
 #endif



Home | Main Index | Thread Index | Old Index