summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/keyboard.c5
-rw-r--r--drivers/input/evbug.c3
-rw-r--r--drivers/input/evdev.c3
-rw-r--r--drivers/input/input.c12
-rw-r--r--drivers/input/joydev.c3
-rw-r--r--drivers/input/mousedev.c21
-rw-r--r--drivers/input/power.c3
-rw-r--r--drivers/input/tsdev.c4
-rw-r--r--include/linux/input.h2
9 files changed, 34 insertions, 22 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 797480768b4e..bf2339c869ea 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -1362,6 +1362,7 @@ static struct input_handler kbd_handler = {
int __init kbd_init(void)
{
int i;
+ int error;
for (i = 0; i < MAX_NR_CONSOLES; i++) {
kbd_table[i].ledflagstate = KBD_DEFLEDS;
@@ -1373,7 +1374,9 @@ int __init kbd_init(void)
kbd_table[i].kbdmode = VC_XLATE;
}
- input_register_handler(&kbd_handler);
+ error = input_register_handler(&kbd_handler);
+ if (error)
+ return error;
tasklet_enable(&keyboard_tasklet);
tasklet_schedule(&keyboard_tasklet);
diff --git a/drivers/input/evbug.c b/drivers/input/evbug.c
index 1d8ce7a1ec30..5a9653c3128a 100644
--- a/drivers/input/evbug.c
+++ b/drivers/input/evbug.c
@@ -91,8 +91,7 @@ static struct input_handler evbug_handler = {
static int __init evbug_init(void)
{
- input_register_handler(&evbug_handler);
- return 0;
+ return input_register_handler(&evbug_handler);
}
static void __exit evbug_exit(void)
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 154e423167b9..6439f378f6cc 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -695,8 +695,7 @@ static struct input_handler evdev_handler = {
static int __init evdev_init(void)
{
- input_register_handler(&evdev_handler);
- return 0;
+ return input_register_handler(&evdev_handler);
}
static void __exit evdev_exit(void)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index c3448364cc73..1c8c8a5bc4a9 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1037,19 +1037,20 @@ void input_unregister_device(struct input_dev *dev)
}
EXPORT_SYMBOL(input_unregister_device);
-void input_register_handler(struct input_handler *handler)
+int input_register_handler(struct input_handler *handler)
{
struct input_dev *dev;
struct input_handle *handle;
const struct input_device_id *id;
- if (!handler)
- return;
-
INIT_LIST_HEAD(&handler->h_list);
- if (handler->fops != NULL)
+ if (handler->fops != NULL) {
+ if (input_table[handler->minor >> 5])
+ return -EBUSY;
+
input_table[handler->minor >> 5] = handler;
+ }
list_add_tail(&handler->node, &input_handler_list);
@@ -1063,6 +1064,7 @@ void input_register_handler(struct input_handler *handler)
}
input_wakeup_procfs_readers();
+ return 0;
}
EXPORT_SYMBOL(input_register_handler);
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 033e3aac92a3..9f3529ad3fda 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -606,8 +606,7 @@ static struct input_handler joydev_handler = {
static int __init joydev_init(void)
{
- input_register_handler(&joydev_handler);
- return 0;
+ return input_register_handler(&joydev_handler);
}
static void __exit joydev_exit(void)
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index cd02f1b62b66..a22a74a2a3dc 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -738,7 +738,12 @@ static int psaux_registered;
static int __init mousedev_init(void)
{
- input_register_handler(&mousedev_handler);
+ struct class_device *cdev;
+ int error;
+
+ error = input_register_handler(&mousedev_handler);
+ if (error)
+ return error;
memset(&mousedev_mix, 0, sizeof(struct mousedev));
INIT_LIST_HEAD(&mousedev_mix.list);
@@ -747,12 +752,20 @@ static int __init mousedev_init(void)
mousedev_mix.exist = 1;
mousedev_mix.minor = MOUSEDEV_MIX;
- class_device_create(&input_class, NULL,
+ cdev = class_device_create(&input_class, NULL,
MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), NULL, "mice");
+ if (IS_ERR(cdev)) {
+ input_unregister_handler(&mousedev_handler);
+ return PTR_ERR(cdev);
+ }
#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
- if (!(psaux_registered = !misc_register(&psaux_mouse)))
- printk(KERN_WARNING "mice: could not misc_register the device\n");
+ error = misc_register(&psaux_mouse);
+ if (error)
+ printk(KERN_WARNING "mice: could not register psaux device, "
+ "error: %d\n", error);
+ else
+ psaux_registered = 1;
#endif
printk(KERN_INFO "mice: PS/2 mouse device common for all mice\n");
diff --git a/drivers/input/power.c b/drivers/input/power.c
index 75d018759cd5..ee82464a2fa7 100644
--- a/drivers/input/power.c
+++ b/drivers/input/power.c
@@ -150,8 +150,7 @@ static struct input_handler power_handler = {
static int __init power_init(void)
{
- input_register_handler(&power_handler);
- return 0;
+ return input_register_handler(&power_handler);
}
static void __exit power_exit(void)
diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c
index 162ee08223a9..a730c461227f 100644
--- a/drivers/input/tsdev.c
+++ b/drivers/input/tsdev.c
@@ -479,9 +479,7 @@ static struct input_handler tsdev_handler = {
static int __init tsdev_init(void)
{
- input_register_handler(&tsdev_handler);
- printk(KERN_INFO "ts: Compaq touchscreen protocol output\n");
- return 0;
+ return input_register_handler(&tsdev_handler);
}
static void __exit tsdev_exit(void)
diff --git a/include/linux/input.h b/include/linux/input.h
index 155b2bc96842..7025432350fa 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1106,7 +1106,7 @@ static inline void input_put_device(struct input_dev *dev)
int input_register_device(struct input_dev *);
void input_unregister_device(struct input_dev *);
-void input_register_handler(struct input_handler *);
+int input_register_handler(struct input_handler *);
void input_unregister_handler(struct input_handler *);
int input_grab_device(struct input_handle *);