From owner-p4-projects@FreeBSD.ORG Thu Jul 5 22:54:17 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A2DA716A469; Thu, 5 Jul 2007 22:54:17 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 57FBC16A421 for ; Thu, 5 Jul 2007 22:54:17 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 3C39613C468 for ; Thu, 5 Jul 2007 22:54:17 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l65MsHwT057495 for ; Thu, 5 Jul 2007 22:54:17 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l65MsGtS057492 for perforce@freebsd.org; Thu, 5 Jul 2007 22:54:16 GMT (envelope-from rpaulo@FreeBSD.org) Date: Thu, 5 Jul 2007 22:54:16 GMT Message-Id: <200707052254.l65MsGtS057492@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo To: Perforce Change Reviews Cc: Subject: PERFORCE change 122978 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2007 22:54:18 -0000 http://perforce.freebsd.org/chv.cgi?CH=122978 Change 122978 by rpaulo@rpaulo_epsilon on 2007/07/05 22:53:40 Don't create a new sysctl tree under hw (previously hw.asmc), use the one provided by newbus (i.e. dev.asmc.N) as this is preferable. Pointed out by: jhb Affected files ... .. //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#19 edit .. //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmcvar.h#9 edit Differences ... ==== //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#19 (text+ko) ==== @@ -23,7 +23,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#18 $ + * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#19 $ * */ @@ -241,8 +241,13 @@ int ret; char name[2]; struct asmc_softc *sc = device_get_softc(dev); + struct sysctl_ctx_list *sysctlctx; + struct sysctl_oid *sysctlnode; struct asmc_model *model; + sysctlctx = device_get_sysctl_ctx(dev); + sysctlnode = device_get_sysctl_tree(dev); + model = asmc_match(dev); mtx_init(&sc->sc_mtx, "asmc", NULL, MTX_SPIN); @@ -252,57 +257,49 @@ sc->sc_model = model; /* - * hw.asmc tree. + * dev.asmc.n.fan.* tree. */ - sysctl_ctx_init(&sc->sc_sysctl_ctx); - sc->sc_root_tree = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx, - SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO, device_get_name(dev), - CTLFLAG_RD, 0, device_get_desc(dev)); - - /* - * hw.asmc.fan.* tree. - */ - sc->sc_fan_tree[0] = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx, - SYSCTL_CHILDREN(sc->sc_root_tree), OID_AUTO, "fan", + sc->sc_fan_tree[0] = SYSCTL_ADD_NODE(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "fan", CTLFLAG_RD, 0, "Fan Root Tree"); for (i = 1; i <= sc->sc_nfan; i++) { j = i - 1; name[0] = '0' + j; name[1] = 0; - sc->sc_fan_tree[i] = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx, + sc->sc_fan_tree[i] = SYSCTL_ADD_NODE(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[0]), OID_AUTO, name, CTLFLAG_RD, 0, "Fan Subtree"); - SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx, + SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[i]), OID_AUTO, "speed", CTLTYPE_INT | CTLFLAG_RD, dev, j, model->smc_fan_speed, "I", "Fan speed in RPM"); - SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx, + SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[i]), OID_AUTO, "safespeed", CTLTYPE_INT | CTLFLAG_RD, dev, j, model->smc_fan_safespeed, "I", "Fan safe speed in RPM"); - SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx, + SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[i]), OID_AUTO, "minspeed", CTLTYPE_INT | CTLFLAG_RD, dev, j, model->smc_fan_minspeed, "I", "Fan minimum speed in RPM"); - SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx, + SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[i]), OID_AUTO, "maxspeed", CTLTYPE_INT | CTLFLAG_RD, dev, j, model->smc_fan_maxspeed, "I", "Fan maximum speed in RPM"); - SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx, + SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[i]), OID_AUTO, "targetspeed", CTLTYPE_INT | CTLFLAG_RD, @@ -311,15 +308,15 @@ } /* - * hw.asmc.temp tree. + * dev.asmc.n.temp tree. */ - sc->sc_temp_tree = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx, - SYSCTL_CHILDREN(sc->sc_root_tree), OID_AUTO, "temp", + sc->sc_temp_tree = SYSCTL_ADD_NODE(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "temp", CTLFLAG_RD, 0, "Temperature sensors"); for (i = 0; model->smc_temps[i]; i++) { - SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx, + SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_temp_tree), OID_AUTO, model->smc_tempnames[i], CTLTYPE_INT | CTLFLAG_RD, @@ -331,25 +328,25 @@ goto out; /* - * hw.asmc.sms tree. + * dev.asmc.n.sms tree. */ - sc->sc_sms_tree = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx, - SYSCTL_CHILDREN(sc->sc_root_tree), OID_AUTO, "sms", + sc->sc_sms_tree = SYSCTL_ADD_NODE(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "sms", CTLFLAG_RD, 0, "Sudden Motion Sensor"); - SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx, + SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_sms_tree), OID_AUTO, "x", CTLTYPE_INT | CTLFLAG_RD, dev, 0, model->smc_sms_x, "I", "Sudden Motion Sensor X value"); - SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx, + SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_sms_tree), OID_AUTO, "y", CTLTYPE_INT | CTLFLAG_RD, dev, 0, model->smc_sms_y, "I", "Sudden Motion Sensor Y value"); - SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx, + SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_sms_tree), OID_AUTO, "z", CTLTYPE_INT | CTLFLAG_RD, dev, 0, model->smc_sms_z, "I", @@ -410,8 +407,6 @@ { struct asmc_softc *sc = device_get_softc(dev); - sysctl_ctx_free(&sc->sc_sysctl_ctx); - if (sc->sc_sms_tq) { taskqueue_drain(sc->sc_sms_tq, &sc->sc_sms_task); taskqueue_free(sc->sc_sms_tq); ==== //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmcvar.h#9 (text+ko) ==== @@ -23,7 +23,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmcvar.h#8 $ + * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmcvar.h#9 $ * */ @@ -36,8 +36,6 @@ int16_t sms_rest_x; int16_t sms_rest_y; int16_t sms_rest_z; - struct sysctl_ctx_list sc_sysctl_ctx; - struct sysctl_oid *sc_root_tree; struct sysctl_oid *sc_fan_tree[ASMC_MAXFANS+1]; struct sysctl_oid *sc_temp_tree; struct sysctl_oid *sc_sms_tree;