diff options
Diffstat (limited to 'sys/dev/fb/fb.c')
-rw-r--r-- | sys/dev/fb/fb.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index 0c354c1..c729e0f 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -36,6 +36,7 @@ #include <sys/bus.h> #include <sys/kernel.h> #include <sys/malloc.h> +#include <sys/module.h> #include <sys/uio.h> #include <sys/fbio.h> @@ -374,18 +375,29 @@ static struct cdevsw fb_cdevsw = { /* bmaj */ -1 }; -static void -vfbattach(void *arg) -{ - static int fb_devsw_installed = FALSE; - if (!fb_devsw_installed) { - cdevsw_add(&fb_cdevsw); - fb_devsw_installed = TRUE; - } -} +static int +fb_modevent(module_t mod, int type, void *data) +{ -PSEUDO_SET(vfbattach, fb); + switch (type) { + case MOD_LOAD: + cdevsw_add(&fb_cdevsw); + break; + case MOD_UNLOAD: + printf("fb module unload - not possible for this module type\n"); + return EINVAL; + } + return 0; +} + +static moduledata_t fb_mod = { + "fb", + fb_modevent, + NULL +}; + +DECLARE_MODULE(fb, fb_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); int fb_attach(dev_t dev, video_adapter_t *adp, struct cdevsw *cdevsw) |