Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Modularize hpet(4). Works nicely with the multipl...



details:   https://anonhg.NetBSD.org/src/rev/7bea34633f33
branches:  trunk
changeset: 766093:7bea34633f33
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Wed Jun 15 09:09:48 2011 +0000

description:
Modularize hpet(4). Works nicely with the multiple bus locations.

diffstat:

 sys/dev/ic/hpet.c |  42 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 39 insertions(+), 3 deletions(-)

diffs (63 lines):

diff -r 1ff3eb4d9082 -r 7bea34633f33 sys/dev/ic/hpet.c
--- a/sys/dev/ic/hpet.c Wed Jun 15 09:02:38 2011 +0000
+++ b/sys/dev/ic/hpet.c Wed Jun 15 09:09:48 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hpet.c,v 1.10 2010/02/24 22:37:58 dyoung Exp $ */
+/* $NetBSD: hpet.c,v 1.11 2011/06/15 09:09:48 jruoho Exp $ */
 
 /*
  * Copyright (c) 2006 Nicolas Joly
@@ -33,11 +33,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.10 2010/02/24 22:37:58 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.11 2011/06/15 09:09:48 jruoho Exp $");
 
 #include <sys/systm.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/module.h>
 
 #include <sys/time.h>
 #include <sys/timetc.h>
@@ -124,3 +124,39 @@
 
        return true;
 }
+
+MODULE(MODULE_CLASS_DRIVER, hpet, NULL);
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+hpet_modcmd(modcmd_t cmd, void *aux)
+{
+       int rv = 0;
+
+       switch (cmd) {
+
+       case MODULE_CMD_INIT:
+
+#ifdef _MODULE
+               rv = config_init_component(cfdriver_ioconf_hpet,
+                   cfattach_ioconf_hpet, cfdata_ioconf_hpet);
+#endif
+               break;
+
+       case MODULE_CMD_FINI:
+
+#ifdef _MODULE
+               rv = config_fini_component(cfdriver_ioconf_hpet,
+                   cfattach_ioconf_hpet, cfdata_ioconf_hpet);
+#endif
+               break;
+
+       default:
+               rv = ENOTTY;
+       }
+
+       return rv;
+}



Home | Main Index | Thread Index | Old Index