diff options
author | jmz <jmz@FreeBSD.org> | 1996-03-15 20:35:06 +0000 |
---|---|---|
committer | jmz <jmz@FreeBSD.org> | 1996-03-15 20:35:06 +0000 |
commit | 38b27e13992cb0b9ebfd863257fe7fa7dd606072 (patch) | |
tree | 65a1bb485596cefe64993a357851f3208ba86bfb /sys/isa | |
parent | 7eae8f5c38e62f3e7ad9cbae40e24d35b91382ef (diff) | |
download | FreeBSD-src-38b27e13992cb0b9ebfd863257fe7fa7dd606072.zip FreeBSD-src-38b27e13992cb0b9ebfd863257fe7fa7dd606072.tar.gz |
Add code to make it a loadable kernel module
Diffstat (limited to 'sys/isa')
-rw-r--r-- | sys/isa/joy.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sys/isa/joy.c b/sys/isa/joy.c index 55a8e5a..c4fdaee 100644 --- a/sys/isa/joy.c +++ b/sys/isa/joy.c @@ -251,4 +251,50 @@ static void joy_drvinit(void *unused) SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL) +#ifdef JOY_MODULE + +#include <sys/exec.h> +#include <sys/sysent.h> +#include <sys/sysproto.h> +#include <sys/lkm.h> + +MOD_DEV (joy, LM_DT_CHAR, CDEV_MAJOR, &joy_cdevsw); + +static struct isa_device dev = {0, &joydriver, IO_GAME, -1, -1, (caddr_t) -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}; + +int +joy_load (struct lkm_table *lkmtp, int cmd) +{ + if (joyprobe (&dev)) { + joyattach (&dev); +/* joy_drvinit (0);*/ + uprintf ("Joystick driver loaded\n"); + return 0; + } else { + uprintf ("Joystick driver: probe failed\n"); + return 1; + } +} + +int +joy_unload (struct lkm_table *lkmtp, int cmd) +{ + uprintf ("Joystick driver unloaded\n"); + return 0; +} +int +joy_stat (struct lkm_table *lkmtp, int cmd) +{ + return 0; +} +int +joy_mod (struct lkm_table *lkmtp, int cmd, int ver) +{ +#define _module joy_module + DISPATCH(lkmtp, cmd, ver, joy_load, joy_unload, joy_stat); +} + +#endif /* JOY_MODULE */ + + #endif /* NJOY > 0 */ |