Module Name: src
Committed By: andvar
Date: Sat Apr 13 09:12:09 UTC 2024
Modified Files:
src/sys/arch/x86/x86: viac7temp.c
Log Message:
viac7temp(4): define module metadata using MODULE() macro and implement
viac7temp_modcmd() to handle module load/unload events.
Fixes PR kern/58148. Look OK by mrg@.
XXX pullup-10, -9, -8
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/x86/viac7temp.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/arch/x86/x86/viac7temp.c
diff -u src/sys/arch/x86/x86/viac7temp.c:1.9 src/sys/arch/x86/x86/viac7temp.c:1.10
--- src/sys/arch/x86/x86/viac7temp.c:1.9 Thu Oct 7 12:52:27 2021
+++ src/sys/arch/x86/x86/viac7temp.c Sat Apr 13 09:12:09 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: viac7temp.c,v 1.9 2021/10/07 12:52:27 msaitoh Exp $ */
+/* $NetBSD: viac7temp.c,v 1.10 2024/04/13 09:12:09 andvar Exp $ */
/*-
* Copyright (c) 2009 Jared D. McNeill <[email protected]>
@@ -27,11 +27,12 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.9 2021/10/07 12:52:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.10 2024/04/13 09:12:09 andvar Exp $");
#include <sys/param.h>
#include <sys/device.h>
#include <sys/kmem.h>
+#include <sys/module.h>
#include <sys/xcall.h>
#include <dev/sysmon/sysmonvar.h>
@@ -162,3 +163,32 @@ viac7temp_refresh_xcall(void *arg0, void
edata->value_cur += 273150000;
edata->state = ENVSYS_SVALID;
}
+
+MODULE(MODULE_CLASS_DRIVER, viac7temp, NULL);
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+viac7temp_modcmd(modcmd_t cmd, void *arg __unused)
+{
+ int error = 0;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+#ifdef _MODULE
+ error = config_init_component(cfdriver_ioconf_viac7temp,
+ cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+ return error;
+ case MODULE_CMD_FINI:
+#ifdef _MODULE
+ error = config_fini_component(cfdriver_ioconf_viac7temp,
+ cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+ return error;
+ default:
+ return ENOTTY;
+ }
+}