diff options
Diffstat (limited to 'drivers/input/mousedev.c')
-rw-r--r-- | drivers/input/mousedev.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index c6194a9dd174..2d0af44ac4b9 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * the Free Software Foundation. | 9 | * the Free Software Foundation. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define MOUSEDEV_MINOR_BASE 32 | 12 | #define MOUSEDEV_MINOR_BASE 32 |
13 | #define MOUSEDEV_MINORS 32 | 13 | #define MOUSEDEV_MINORS 32 |
14 | #define MOUSEDEV_MIX 31 | 14 | #define MOUSEDEV_MIX 31 |
15 | 15 | ||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/random.h> | 24 | #include <linux/random.h> |
25 | #include <linux/major.h> | 25 | #include <linux/major.h> |
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/devfs_fs_kernel.h> | ||
28 | #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX | 27 | #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX |
29 | #include <linux/miscdevice.h> | 28 | #include <linux/miscdevice.h> |
30 | #endif | 29 | #endif |
@@ -621,6 +620,7 @@ static struct file_operations mousedev_fops = { | |||
621 | static struct input_handle *mousedev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id) | 620 | static struct input_handle *mousedev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id) |
622 | { | 621 | { |
623 | struct mousedev *mousedev; | 622 | struct mousedev *mousedev; |
623 | struct class_device *cdev; | ||
624 | int minor = 0; | 624 | int minor = 0; |
625 | 625 | ||
626 | for (minor = 0; minor < MOUSEDEV_MINORS && mousedev_table[minor]; minor++); | 626 | for (minor = 0; minor < MOUSEDEV_MINORS && mousedev_table[minor]; minor++); |
@@ -649,11 +649,13 @@ static struct input_handle *mousedev_connect(struct input_handler *handler, stru | |||
649 | 649 | ||
650 | mousedev_table[minor] = mousedev; | 650 | mousedev_table[minor] = mousedev; |
651 | 651 | ||
652 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), | 652 | cdev = class_device_create(&input_class, &dev->cdev, |
653 | S_IFCHR|S_IRUGO|S_IWUSR, "input/mouse%d", minor); | ||
654 | class_device_create(input_class, | ||
655 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), | 653 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), |
656 | dev->dev, "mouse%d", minor); | 654 | dev->cdev.dev, mousedev->name); |
655 | |||
656 | /* temporary symlink to keep userspace happy */ | ||
657 | sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, | ||
658 | mousedev->name); | ||
657 | 659 | ||
658 | return &mousedev->handle; | 660 | return &mousedev->handle; |
659 | } | 661 | } |
@@ -663,9 +665,9 @@ static void mousedev_disconnect(struct input_handle *handle) | |||
663 | struct mousedev *mousedev = handle->private; | 665 | struct mousedev *mousedev = handle->private; |
664 | struct mousedev_list *list; | 666 | struct mousedev_list *list; |
665 | 667 | ||
666 | class_device_destroy(input_class, | 668 | sysfs_remove_link(&input_class.subsys.kset.kobj, mousedev->name); |
669 | class_device_destroy(&input_class, | ||
667 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); | 670 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); |
668 | devfs_remove("input/mouse%d", mousedev->minor); | ||
669 | mousedev->exist = 0; | 671 | mousedev->exist = 0; |
670 | 672 | ||
671 | if (mousedev->open) { | 673 | if (mousedev->open) { |
@@ -738,9 +740,7 @@ static int __init mousedev_init(void) | |||
738 | mousedev_mix.exist = 1; | 740 | mousedev_mix.exist = 1; |
739 | mousedev_mix.minor = MOUSEDEV_MIX; | 741 | mousedev_mix.minor = MOUSEDEV_MIX; |
740 | 742 | ||
741 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), | 743 | class_device_create(&input_class, NULL, |
742 | S_IFCHR|S_IRUGO|S_IWUSR, "input/mice"); | ||
743 | class_device_create(input_class, | ||
744 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), NULL, "mice"); | 744 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), NULL, "mice"); |
745 | 745 | ||
746 | #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX | 746 | #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX |
@@ -759,8 +759,7 @@ static void __exit mousedev_exit(void) | |||
759 | if (psaux_registered) | 759 | if (psaux_registered) |
760 | misc_deregister(&psaux_mouse); | 760 | misc_deregister(&psaux_mouse); |
761 | #endif | 761 | #endif |
762 | devfs_remove("input/mice"); | 762 | class_device_destroy(&input_class, |
763 | class_device_destroy(input_class, | ||
764 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX)); | 763 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX)); |
765 | input_unregister_handler(&mousedev_handler); | 764 | input_unregister_handler(&mousedev_handler); |
766 | } | 765 | } |