aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-05-05 23:37:38 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2022-05-05 23:37:38 +0000
commite4ec982c75e3b31758de11a103f0f6bcd4fda10e (patch)
treedd02779599177f5635b21cddd5829bb3397bd6c4
parent5ad42f80559cd37fbd2897df4f6462fb43330608 (diff)
downloadsrc-e4ec982c75e3b31758de11a103f0f6bcd4fda10e.tar.gz
src-e4ec982c75e3b31758de11a103f0f6bcd4fda10e.zip
tdfx: Initialize tdfx_devclass via a module event handler.
Differential Revision: https://reviews.freebsd.org/D35065
-rw-r--r--sys/dev/tdfx/tdfx_pci.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/dev/tdfx/tdfx_pci.c b/sys/dev/tdfx/tdfx_pci.c
index 79ecf112d169..ef95cd971a73 100644
--- a/sys/dev/tdfx/tdfx_pci.c
+++ b/sys/dev/tdfx/tdfx_pci.c
@@ -800,6 +800,26 @@ tdfx_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *
return 0;
}
+static int
+tdfx_mod_event(module_t mod, int what, void *arg)
+{
+ int error;
+
+ switch (what) {
+ case MOD_LOAD:
+ tdfx_devclass = devclass_create("tdfx");
+ error = 0;
+ break;
+ case MOD_UNLOAD:
+ error = 0;
+ break;
+ default:
+ error = EOPNOTSUPP;
+ break;
+ }
+ return (error);
+}
+
/* This is the device driver struct. This is sent to the driver subsystem to
* register the method structure and the info strcut space for this particular
* instance of the driver.
@@ -811,6 +831,6 @@ static driver_t tdfx_driver = {
};
/* Tell Mr. Kernel about us! */
-DRIVER_MODULE(tdfx, pci, tdfx_driver, tdfx_devclass, 0, 0);
+DRIVER_MODULE(tdfx, pci, tdfx_driver, tdfx_mod_event, NULL);
MODULE_DEPEND(tdfx, mem, 1, 1, 1);
MODULE_VERSION(tdfx, 1);