Messages in this thread Patch in this message | | | From | (Bjorn Ekwall) | Subject | fix for misc.c (ex-mouse.c) with kerneld | Date | Sat, 30 Mar 1996 20:42:35 +0100 (MET) |
| |
Hi all and Linus!
Here is an updated (and correct...) patch for drivers/char/misc.c. It includes kerneld support for all your favourite misc modules.
Bjorn <bj0rn@blox.se>
--- linux-1.3.81/drivers/char/misc.c.org Sat Mar 30 20:27:06 1996 +++ linux/drivers/char/misc.c Sat Mar 30 20:38:07 1996 @@ -21,14 +21,19 @@ * Dynamic minors and /proc/mice by Alessandro Rubini. 26-Mar-96 * * Renamed to misc and miscdevice to be more accurate. Alan Cox 26-May-96 + * + * Handling of mouse minor numbers for kerneld: + * Idea by Jacques Gelinas <jack@solucorp.qc.ca>, + * adapted by Bjorn Ekwall <bj0rn@blox.se> + * corrected by Alan Cox <alan@lxorguk.ukuu.org.uk> */ +#include <linux/config.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/errno.h> #include <linux/miscdevice.h> -#include <linux/config.h> #include <linux/kernel.h> #include <linux/major.h> #include <linux/malloc.h> @@ -37,6 +42,9 @@ #include <linux/tty.h> /* needed by selection.h */ #include "selection.h" /* export its symbols */ +#ifdef CONFIG_KERNELD +#include <linux/kerneld.h> +#endif /* * Head entry for the doubly linked miscdevice list @@ -76,17 +84,25 @@ struct miscdevice *c = misc_list.next; file->f_op = NULL; - while (c != &misc_list) { - if (c->minor == minor) { - file->f_op = c->fops; - break; - } + while ((c != &misc_list) && (c->minor != minor)) c = c->next; + if (c == &misc_list) { +#ifdef CONFIG_KERNELD + char modname[20]; + sprintf(modname, "char-major-%d-%d", MISC_MAJOR, minor); + request_module(modname); + c = misc_list.next; + while ((c != &misc_list) && (c->minor != minor)) + c = c->next; + if (c == &misc_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 misc_fops = { @@ -145,7 +161,7 @@ void cleanup_module(void) { - unregister_chrdev(MOUSE_MAJOR, "misc"); + unregister_chrdev(MISC_MAJOR, "misc"); } #endif
| |