Date: Thu, 5 Jul 2007 22:54:16 GMT From: Rui Paulo <rpaulo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 122978 for review Message-ID: <200707052254.l65MsGtS057492@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707052254.l65MsGtS057492>