Merge branch 'drm-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[pandora-kernel.git] / drivers / input / mousedev.c
index 1f851ac..664bcc8 100644 (file)
@@ -196,12 +196,12 @@ static void mousedev_key_event(struct mousedev *mousedev, unsigned int code, int
        switch (code) {
                case BTN_TOUCH:
                case BTN_0:
-               case BTN_FORWARD:
                case BTN_LEFT:          index = 0; break;
                case BTN_STYLUS:
                case BTN_1:
                case BTN_RIGHT:         index = 1; break;
                case BTN_2:
+               case BTN_FORWARD:
                case BTN_STYLUS2:
                case BTN_MIDDLE:        index = 2; break;
                case BTN_3:
@@ -614,7 +614,7 @@ static unsigned int mousedev_poll(struct file *file, poll_table *wait)
                (list->mousedev->exist ? 0 : (POLLHUP | POLLERR));
 }
 
-static struct file_operations mousedev_fops = {
+static const struct file_operations mousedev_fops = {
        .owner =        THIS_MODULE,
        .read =         mousedev_read,
        .write =        mousedev_write,
@@ -624,7 +624,8 @@ static struct file_operations mousedev_fops = {
        .fasync =       mousedev_fasync,
 };
 
-static struct input_handle *mousedev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id)
+static struct input_handle *mousedev_connect(struct input_handler *handler, struct input_dev *dev,
+                                            const struct input_device_id *id)
 {
        struct mousedev *mousedev;
        struct class_device *cdev;
@@ -688,7 +689,7 @@ static void mousedev_disconnect(struct input_handle *handle)
        }
 }
 
-static struct input_device_id mousedev_ids[] = {
+static const struct input_device_id mousedev_ids[] = {
        {
                .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_RELBIT,
                .evbit = { BIT(EV_KEY) | BIT(EV_REL) },
@@ -737,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);
@@ -746,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");