diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-11-28 03:58:46 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-11-28 03:58:46 +0000 |
commit | b63ad0882a16a5d28003e57f2b0b81dee3fb322b (patch) | |
tree | 0a343ce219e2b8b38a5d702d66032c57b83d9720 /drivers/input | |
parent | a9d7bff9a84dba79609a0002e5321b74c4d64c64 (diff) |
Merge with 2.4.0-test11.
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/evdev.c | 4 | ||||
-rw-r--r-- | drivers/input/input.c | 6 | ||||
-rw-r--r-- | drivers/input/joydev.c | 4 | ||||
-rw-r--r-- | drivers/input/mousedev.c | 7 |
4 files changed, 15 insertions, 6 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 65109e9ca..8e676b8da 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -123,7 +123,7 @@ static int evdev_open(struct inode * inode, struct file * file) struct evdev_list *list; int i = MINOR(inode->i_rdev) - EVDEV_MINOR_BASE; - if (i > EVDEV_MINORS || !evdev_table[i]) + if (i >= EVDEV_MINORS || !evdev_table[i]) return -ENODEV; if (!(list = kmalloc(sizeof(struct evdev_list), GFP_KERNEL))) @@ -288,7 +288,7 @@ static struct input_handle *evdev_connect(struct input_handler *handler, struct int minor; for (minor = 0; minor < EVDEV_MINORS && evdev_table[minor]; minor++); - if (evdev_table[minor]) { + if (minor == EVDEV_MINORS) { printk(KERN_ERR "evdev: no more free evdev devices\n"); return NULL; } diff --git a/drivers/input/input.c b/drivers/input/input.c index e121192a6..c78e49086 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -29,6 +29,8 @@ */ #include <linux/init.h> +#include <linux/sched.h> +#include <linux/smp_lock.h> #include <linux/input.h> #include <linux/module.h> #include <linux/random.h> @@ -378,7 +380,11 @@ static int input_open_file(struct inode *inode, struct file *file) } old_fops = file->f_op; file->f_op = new_fops; + + lock_kernel(); err = new_fops->open(inode, file); + unlock_kernel(); + if (err) { fops_put(file->f_op); file->f_op = fops_get(old_fops); diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 90c4dbcef..4e12f55b7 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -193,7 +193,7 @@ static int joydev_open(struct inode *inode, struct file *file) struct joydev_list *list; int i = MINOR(inode->i_rdev) - JOYDEV_MINOR_BASE; - if (i > JOYDEV_MINORS || !joydev_table[i]) + if (i >= JOYDEV_MINORS || !joydev_table[i]) return -ENODEV; if (!(list = kmalloc(sizeof(struct joydev_list), GFP_KERNEL))) @@ -395,7 +395,7 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct || test_bit(BTN_1, dev->keybit)))) return NULL; for (minor = 0; minor < JOYDEV_MINORS && joydev_table[minor]; minor++); - if (joydev_table[minor]) { + if (minor == JOYDEV_MINORS) { printk(KERN_ERR "joydev: no more free joydev devices\n"); return NULL; } diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 1aa85e227..e6a9e02a1 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -39,6 +39,7 @@ #include <linux/input.h> #include <linux/config.h> #include <linux/smp_lock.h> +#include <linux/random.h> #ifndef CONFIG_INPUT_MOUSEDEV_SCREEN_X #define CONFIG_INPUT_MOUSEDEV_SCREEN_X 1024 @@ -86,6 +87,8 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig struct mousedev_list *list; int index, size; + add_mouse_randomness((type << 4) ^ code ^ (code >> 4) ^ value); + while (*mousedev) { list = (*mousedev)->list; while (list) { @@ -213,7 +216,7 @@ static int mousedev_open(struct inode * inode, struct file * file) struct mousedev_list *list; int i = MINOR(inode->i_rdev) - MOUSEDEV_MINOR_BASE; - if (i > MOUSEDEV_MINORS || !mousedev_table[i]) + if (i >= MOUSEDEV_MINORS || !mousedev_table[i]) return -ENODEV; if (!(list = kmalloc(sizeof(struct mousedev_list), GFP_KERNEL))) @@ -407,7 +410,7 @@ static struct input_handle *mousedev_connect(struct input_handler *handler, stru return NULL; for (minor = 0; minor < MOUSEDEV_MINORS && mousedev_table[minor]; minor++); - if (mousedev_table[minor]) { + if (minor == MOUSEDEV_MINORS) { printk(KERN_ERR "mousedev: no more free mousedev devices\n"); return NULL; } |