Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/4d890dfc108a
branches:  trunk
changeset: 767817:4d890dfc108a
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Jul 31 16:18:54 2011 +0000

description:
modularize

diffstat:

 sys/dev/isa/smsc.c |  34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diffs (56 lines):

diff -r bbea09960f62 -r 4d890dfc108a sys/dev/isa/smsc.c
--- a/sys/dev/isa/smsc.c        Sun Jul 31 16:05:28 2011 +0000
+++ b/sys/dev/isa/smsc.c        Sun Jul 31 16:18:54 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smsc.c,v 1.10 2011/06/20 18:12:54 pgoyette Exp $ */
+/*     $NetBSD: smsc.c,v 1.11 2011/07/31 16:18:54 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -40,11 +40,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smsc.c,v 1.10 2011/06/20 18:12:54 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smsc.c,v 1.11 2011/07/31 16:18:54 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
+#include <sys/module.h>
 #include <sys/bus.h>
 
 #include <dev/isa/isareg.h>
@@ -341,3 +342,32 @@
                break;
        }
 }
+
+MODULE(MODULE_CLASS_DRIVER, smsc, NULL);
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+smsc_modcmd(modcmd_t cmd, void *opaque)
+{
+       int error = 0;
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+#ifdef _MODULE
+               error = config_init_component(cfdriver_ioconf_smsc,
+                   cfattach_ioconf_smsc, cfdata_ioconf_smsc);
+#endif
+               return error;
+       case MODULE_CMD_FINI:
+#ifdef _MODULE
+               error = config_fini_component(cfdriver_ioconf_smsc,
+                   cfattach_ioconf_smsc, cfdata_ioconf_smsc);
+#endif
+               return error;
+       default:
+               return ENOTTY;
+       }
+}



Home | Main Index | Thread Index | Old Index