Module Name:    src
Committed By:   jruoho
Date:           Wed Jun 15 09:09:48 UTC 2011

Modified Files:
        src/sys/dev/ic: hpet.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/hpet.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/ic/hpet.c
diff -u src/sys/dev/ic/hpet.c:1.10 src/sys/dev/ic/hpet.c:1.11
--- src/sys/dev/ic/hpet.c:1.10	Wed Feb 24 22:37:58 2010
+++ src/sys/dev/ic/hpet.c	Wed Jun 15 09:09:48 2011
@@ -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;
+}

Reply via email to