1 diff -urNp linux-1255/drivers/input/input.c linux-1261/drivers/input/input.c
2 --- linux-1255/drivers/input/input.c
3 +++ linux-1261/drivers/input/input.c
5 #include <linux/input.h>
6 #include <linux/module.h>
7 #include <linux/random.h>
8 +#include <linux/kmod.h>
10 MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
11 MODULE_DESCRIPTION("Input layer module");
12 @@ -370,12 +371,20 @@ void input_unregister_handler(struct inp
14 static int input_open_file(struct inode *inode, struct file *file)
16 - struct input_handler *handler = input_table[MINOR(inode->i_rdev) >> 5];
17 - struct file_operations *old_fops, *new_fops = NULL;
18 + struct input_handler *handler;
19 + struct file_operations *old_fops, *new_fops;
20 + unsigned int minor = MINOR(inode->i_rdev);
23 - /* No load-on-demand here? */
24 - if (!handler || !(new_fops = fops_get(handler->fops)))
25 + /* XXX Are we sure there's no locking problem here? */
26 + if (!(handler = input_table[minor >> 5])) {
27 + char modnam[sizeof("char-major-00000-000000000")];
28 + sprintf(modnam, "char-major-%d-%d", INPUT_MAJOR, minor & ~0x1f);
29 + request_module(modnam);
30 + if (!(handler = input_table[minor >> 5]))
33 + if (!(new_fops = fops_get(handler->fops)))