Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/i2c modularize



details:   https://anonhg.NetBSD.org/src/rev/e2d2c15d02cf
branches:  trunk
changeset: 767815:e2d2c15d02cf
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Jul 31 16:05:01 2011 +0000

description:
modularize

diffstat:

 sys/dev/i2c/dbcool.c |  36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)

diffs (68 lines):

diff -r 37599ac4f90a -r e2d2c15d02cf sys/dev/i2c/dbcool.c
--- a/sys/dev/i2c/dbcool.c      Sun Jul 31 16:00:21 2011 +0000
+++ b/sys/dev/i2c/dbcool.c      Sun Jul 31 16:05:01 2011 +0000
@@ -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;
+       }
+}



Home | Main Index | Thread Index | Old Index