lkml.org 
[lkml]   [1996]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: Oh dear, I meant _this_ patch to mouse.c
Date
Alan Cox wrote:
>
[...]
> Yeuch Yeuch no no no no etc. Pass the minor number. There could be 256
> things in that table [which also ought to be #ifdef'd out for no kerneld].
>
> Alan
>

Right you are...

Better?

Bjorn


--- linux/drivers/char/mouse.c.org Tue Mar 19 01:34:28 1996
+++ linux/drivers/char/mouse.c Tue Mar 19 17:09:19 1996
@@ -17,8 +17,14 @@
*
* 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>
+ * corrected by Alan Cox <alan@lxorguk.ukuu.org.uk>
*/

+#include <linux/config.h>
#include <linux/module.h>

#include <linux/fs.h>
@@ -28,6 +34,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
@@ -47,17 +56,25 @@
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
+ char modname[20];
+ sprintf(modname, "char-major-%d-%d", MOUSE_MAJOR, minor);
+ request_module(modname);
+ 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 = {

\
 
 \ /
  Last update: 2005-03-22 13:36    [W:0.078 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site