git: e4ec982c75e3 - main - tdfx: Initialize tdfx_devclass via a module event handler.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 05 May 2022 23:42:26 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e4ec982c75e3b31758de11a103f0f6bcd4fda10e commit e4ec982c75e3b31758de11a103f0f6bcd4fda10e Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2022-05-05 23:37:38 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2022-05-05 23:37:38 +0000 tdfx: Initialize tdfx_devclass via a module event handler. Differential Revision: https://reviews.freebsd.org/D35065 --- sys/dev/tdfx/tdfx_pci.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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);