Messages in this thread Patch in this message | | | From | (Bjorn Ekwall) | Subject | Oh dear, I meant _this_ patch to mouse.c | Date | Tue, 19 Mar 1996 08:00:27 +0100 (MET) |
| |
I re-optimised my patch on time too many and didn't re-compile the last version. Sorry... The "#else" in mouse_open _should_ have been "#endif"
I promise I won't proofread source in the middle of the night I promise I won't proofread source in the middle of the night I promise I won't proofread source in the middle of the night I promise I won't proofread source in the middle of the night I promise I won't proofread source in the middle of the night [the remaining 95 identical lines deleted for brevity]
So, _this_ is what I think it should look like:
Bjorn
--- linux/drivers/char/mouse.c.org Tue Mar 19 01:34:28 1996 +++ linux/drivers/char/mouse.c Tue Mar 19 07:46:35 1996 @@ -17,8 +17,13 @@ * * Fixed a failing symbol register to free the device registration * Alan Cox <alan@lxorguk.ukuu.org.uk> 21-Jan-96 + * + * Handling of mouse minor numbers for kerneld: + * Idea by Jacques Gelinas <jack@solucorp.qc.ca>, + * adapted by Bjorn Ekwall <bj0rn@blox.se> */ +#include <linux/config.h> #include <linux/module.h> #include <linux/fs.h> @@ -28,6 +33,9 @@ #include <linux/kernel.h> #include <linux/major.h> #include <linux/malloc.h> +#ifdef CONFIG_KERNELD +#include <linux/kerneld.h> +#endif /* * Head entry for the doubly linked mouse list @@ -41,6 +49,26 @@ extern int atixl_busmouse_init(void); #endif +#ifndef WATCHDOG_MINOR +#define WATCHDOG_MINOR 130 +#endif +#ifndef TEMP_MINOR +#define TEMP_MINOR 131 +#endif + +static struct { + int minor; + char *module; +} mice[] = { + { BUSMOUSE_MINOR, "busmouse" }, + { PSMOUSE_MINOR, "psaux" }, + { MS_BUSMOUSE_MINOR, "msbusmouse" }, + { ATIXL_BUSMOUSE_MINOR, "atixlmouse" }, + { WATCHDOG_MINOR, "wdt" }, + { TEMP_MINOR, "wdt" }, + {-1, NULL} /* end of list */ +}; + static int mouse_open(struct inode * inode, struct file * file) { int minor = MINOR(inode->i_rdev); @@ -47,17 +75,28 @@ struct mouse *c = mouse_list.next; file->f_op = NULL; - while (c != &mouse_list) { - if (c->minor == minor) { - file->f_op = c->fops; - break; - } + while ((c != &mouse_list) && (c->minor != minor)) c = c->next; + if (c == &mouse_list) { +#ifdef CONFIG_KERNELD + int i; + for (i = 0; mice[i].minor >= 0 && mice[i].minor != minor; ++i) + ; + if (mice[i].minor != -1) { + request_module(mice[i].module); + c = mouse_list.next; + while ((c != &mouse_list) && (c->minor != minor)) + c = c->next; + } + if (c == &mouse_list) +#endif + return -ENODEV; } - if (file->f_op == NULL) + if ((file->f_op = c->fops)) + return file->f_op->open(inode,file); + else return -ENODEV; - return file->f_op->open(inode,file); } static struct file_operations mouse_fops = {
| |