Module Name: src
Committed By: jmcneill
Date: Sun Jul 31 16:05:01 UTC 2011
Modified Files:
src/sys/dev/i2c: dbcool.c
Log Message:
modularize
To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/i2c/dbcool.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/i2c/dbcool.c
diff -u src/sys/dev/i2c/dbcool.c:1.30 src/sys/dev/i2c/dbcool.c:1.31
--- src/sys/dev/i2c/dbcool.c:1.30 Mon Jun 20 20:16:19 2011
+++ src/sys/dev/i2c/dbcool.c Sun Jul 31 16:05:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: dbcool.c,v 1.30 2011/06/20 20:16:19 pgoyette Exp $ */
+/* $NetBSD: dbcool.c,v 1.31 2011/07/31 16:05:01 jmcneill Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.30 2011/06/20 20:16:19 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.31 2011/07/31 16:05:01 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -58,6 +58,7 @@
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/sysctl.h>
+#include <sys/module.h>
#include <dev/i2c/dbcool_var.h>
#include <dev/i2c/dbcool_reg.h>
@@ -794,6 +795,8 @@
{
struct dbcool_softc *sc = device_private(self);
+ pmf_device_deregister(self);
+
sysmon_envsys_unregister(sc->sc_sme);
sc->sc_sme = NULL;
return 0;
@@ -2159,3 +2162,32 @@
sc->sc_dc.dc_writereg(&sc->sc_dc, reg->lo_lim_reg + 1, 0xff);
}
}
+
+MODULE(MODULE_CLASS_DRIVER, dbcool, NULL);
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+dbcool_modcmd(modcmd_t cmd, void *opaque)
+{
+ int error = 0;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+#ifdef _MODULE
+ error = config_init_component(cfdriver_ioconf_dbcool,
+ cfattach_ioconf_dbcool, cfdata_ioconf_dbcool);
+#endif
+ return error;
+ case MODULE_CMD_FINI:
+#ifdef _MODULE
+ error = config_fini_component(cfdriver_ioconf_dbcool,
+ cfattach_ioconf_dbcool, cfdata_ioconf_dbcool);
+#endif
+ return error;
+ default:
+ return ENOTTY;
+ }
+}