Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c When detaching the device, tear down its sysctl ...
details: https://anonhg.NetBSD.org/src/rev/953527dd2a7c
branches: trunk
changeset: 767887:953527dd2a7c
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Tue Aug 02 14:06:15 2011 +0000
description:
When detaching the device, tear down its sysctl tree.
diffstat:
sys/dev/i2c/dbcool.c | 33 +++++++++++++++++++++------------
sys/dev/i2c/dbcool_var.h | 5 +++--
2 files changed, 24 insertions(+), 14 deletions(-)
diffs (150 lines):
diff -r 7f6b6cf367ff -r 953527dd2a7c sys/dev/i2c/dbcool.c
--- a/sys/dev/i2c/dbcool.c Tue Aug 02 10:28:00 2011 +0000
+++ b/sys/dev/i2c/dbcool.c Tue Aug 02 14:06:15 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dbcool.c,v 1.32 2011/08/01 22:42:57 macallan Exp $ */
+/* $NetBSD: dbcool.c,v 1.33 2011/08/02 14:06:15 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.32 2011/08/01 22:42:57 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.33 2011/08/02 14:06:15 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -98,6 +98,7 @@
sysmon_envsys_lim_t *, uint32_t *);
/* SYSCTL Helpers */
+SYSCTL_SETUP_PROTO(sysctl_dbcoolsetup);
static int sysctl_dbcool_temp(SYSCTLFN_PROTO);
static int sysctl_adm1030_temp(SYSCTLFN_PROTO);
static int sysctl_adm1030_trange(SYSCTLFN_PROTO);
@@ -784,6 +785,12 @@
aprint_normal_dev(self, "%s dBCool(tm) Controller "
"(rev 0x%04x)\n", sc->sc_dc.dc_chip->name, ver);
+ sc->sc_sysctl_log = NULL;
+
+#ifdef _MODULE
+ sysctl_dbcoolsetup(&sc->sc_sysctl_log);
+#endif
+
dbcool_setup(self);
if (!pmf_device_register(self, dbcool_pmf_suspend, dbcool_pmf_resume))
@@ -798,6 +805,9 @@
pmf_device_deregister(self);
sysmon_envsys_unregister(sc->sc_sme);
+
+ sysctl_teardown(&sc->sc_sysctl_log);
+
sc->sc_sme = NULL;
return 0;
}
@@ -1104,7 +1114,7 @@
SYSCTL_SETUP(sysctl_dbcoolsetup, "sysctl dBCool subtree setup")
{
- sysctl_createv(NULL, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "hw", NULL,
NULL, 0, NULL, 0,
@@ -1504,7 +1514,7 @@
/* Determine Vcc for this chip */
sc->sc_supply_voltage = dbcool_supply_voltage(sc);
- ret = sysctl_createv(NULL, 0, NULL, &me,
+ ret = sysctl_createv(&sc->sc_sysctl_log, 0, NULL, &me,
CTLFLAG_READWRITE,
CTLTYPE_NODE, device_xname(self), NULL,
NULL, 0, NULL, 0,
@@ -1531,7 +1541,7 @@
dbcool_setup_controllers(sc);
#ifdef DBCOOL_DEBUG
- ret = sysctl_createv(NULL, 0, NULL,
+ ret = sysctl_createv(&sc->sc_sysctl_log, 0, NULL,
(const struct sysctlnode **)&node,
CTLFLAG_READWRITE, CTLTYPE_INT, "reg_select", NULL,
sysctl_dbcool_reg_select,
@@ -1540,7 +1550,7 @@
if (node != NULL)
node->sysctl_data = sc;
- ret = sysctl_createv(NULL, 0, NULL,
+ ret = sysctl_createv(&sc->sc_sysctl_log, 0, NULL,
(const struct sysctlnode **)&node,
CTLFLAG_READWRITE, CTLTYPE_INT, "reg_access", NULL,
sysctl_dbcool_reg_access,
@@ -1704,7 +1714,8 @@
/* create sysctl node for the sensor if not one already there */
if (sc->sc_sysctl_num[j] == -1) {
- ret = sysctl_createv(NULL, 0, NULL, &me2, CTLFLAG_READWRITE,
+ ret = sysctl_createv(&sc->sc_sysctl_log, 0, NULL, &me2,
+ CTLFLAG_READWRITE,
CTLTYPE_NODE, sc->sc_sensor[j].desc, NULL,
NULL, 0, NULL, 0,
CTL_HW, sc->sc_root_sysctl_num, CTL_CREATE,
@@ -1722,9 +1733,7 @@
rw_flag = CTLFLAG_READONLY | CTLFLAG_OWNDESC;
else
rw_flag = CTLFLAG_READWRITE | CTLFLAG_OWNDESC;
-
- ret = sysctl_createv(NULL, 0, NULL,
- &node, rw_flag,
+ ret = sysctl_createv(&sc->sc_sysctl_log, 0, NULL, &node, rw_flag,
CTLTYPE_INT, name,
SYSCTL_DESCR(dbc_sysctl_table[sysctl_index].desc),
dbc_sysctl_table[sysctl_index].helper,
@@ -1748,7 +1757,7 @@
for (i = 0; chip->power[i].desc != NULL; i++) {
snprintf(name, sizeof(name), "fan_ctl_%d", i);
- ret = sysctl_createv(NULL, 0, NULL, &me2,
+ ret = sysctl_createv(&sc->sc_sysctl_log, 0, NULL, &me2,
CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
CTLTYPE_NODE, name, NULL,
NULL, 0, NULL, 0,
@@ -1766,7 +1775,7 @@
rw_flag = CTLFLAG_READONLY | CTLFLAG_OWNDESC;
else
rw_flag = CTLFLAG_READWRITE | CTLFLAG_OWNDESC;
- ret = sysctl_createv(NULL, 0, NULL,
+ ret = sysctl_createv(&sc->sc_sysctl_log, 0, NULL,
&node, rw_flag,
(j == DBC_PWM_BEHAVIOR)?
CTLTYPE_STRING:CTLTYPE_INT,
diff -r 7f6b6cf367ff -r 953527dd2a7c sys/dev/i2c/dbcool_var.h
--- a/sys/dev/i2c/dbcool_var.h Tue Aug 02 10:28:00 2011 +0000
+++ b/sys/dev/i2c/dbcool_var.h Tue Aug 02 14:06:15 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dbcool_var.h,v 1.13 2011/03/11 17:12:43 pgoyette Exp $ */
+/* $NetBSD: dbcool_var.h,v 1.14 2011/08/02 14:06:15 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbcool_var.h,v 1.13 2011/03/11 17:12:43 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbcool_var.h,v 1.14 2011/08/02 14:06:15 pgoyette Exp $");
#include <dev/i2c/i2cvar.h>
@@ -128,6 +128,7 @@
int sc_temp_offset;
int64_t sc_supply_voltage;
bool sc_suspend;
+ struct sysctllog *sc_sysctl_log;
#ifdef DBCOOL_DEBUG
uint8_t sc_user_reg;
#endif
Home |
Main Index |
Thread Index |
Old Index