Use const nodes. Let sysctl_createv initialize sysctl_data.

This commit is contained in:
mlelstv 2012-07-29 07:04:09 +00:00
parent fa22835bbb
commit e5129e3384

View File

@ -1,4 +1,4 @@
/* $NetBSD: g760a.c,v 1.3 2012/07/28 23:03:47 matt Exp $ */
/* $NetBSD: g760a.c,v 1.4 2012/07/29 07:04:09 mlelstv Exp $ */
/*-
* Copyright (C) 2008 A.Leo.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: g760a.c,v 1.3 2012/07/28 23:03:47 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: g760a.c,v 1.4 2012/07/29 07:04:09 mlelstv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -218,11 +218,11 @@ g760a_setup(struct g760a_softc* sc)
{
int error;
int ret;
struct sysctlnode* me = NULL, * node = NULL;
const struct sysctlnode *me, *node;
sc->sc_sme = sysmon_envsys_create();
ret = sysctl_createv(NULL, 0, NULL, (void *)&me,
ret = sysctl_createv(NULL, 0, NULL, &me,
CTLFLAG_READWRITE,
CTLTYPE_NODE, device_xname(sc->sc_dev), NULL,
NULL, 0, NULL, 0,
@ -236,13 +236,11 @@ g760a_setup(struct g760a_softc* sc)
if (sysmon_envsys_sensor_attach(sc->sc_sme, &sc->sc_sensor))
goto out;
ret = sysctl_createv(NULL, 0, NULL, (void *)&node,
ret = sysctl_createv(NULL, 0, NULL, &node,
CTLFLAG_READWRITE,
CTLTYPE_INT, "rpm", sc->sc_sensor.desc,
sysctl_g760a_rpm, 0x42, NULL, 0,
sysctl_g760a_rpm, 0x42, (void*)sc, 0,
CTL_MACHDEP, me->sysctl_num, CTL_CREATE, CTL_EOL);
if (node != NULL)
node->sysctl_data = sc;
sc->sc_sme->sme_name = device_xname(sc->sc_dev);
sc->sc_sme->sme_cookie = sc;