aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-11-02 22:51:46 -0500
committerDmitry Torokhov <dtor_core@ameritech.net>2005-11-02 22:51:46 -0500
commit5f94548982ad8cb9867297e9e18e50ec7b8accea (patch)
treebddaa8a9b37decec5663d2a8d17c93dd732ad8c8 /drivers/input
parent438c9da5143c6a563c5c684b91eb7848a7b2d83d (diff)
Input: do not register statically allocated devices
Do not register statically allocated input devices to prevent OOPS when attaching input interfaces since it requires class device to be properly initialized. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/input.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 1a1654caedd5..d543c0ce5229 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -377,7 +377,7 @@ static int input_devices_read(char *buf, char **start, off_t pos, int count, int
377 377
378 list_for_each_entry(dev, &input_dev_list, node) { 378 list_for_each_entry(dev, &input_dev_list, node) {
379 379
380 path = dev->dynalloc ? kobject_get_path(&dev->cdev.kobj, GFP_KERNEL) : NULL; 380 path = kobject_get_path(&dev->cdev.kobj, GFP_KERNEL);
381 381
382 len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n", 382 len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n",
383 dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version); 383 dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version);
@@ -741,15 +741,21 @@ static void input_register_classdevice(struct input_dev *dev)
741 sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group); 741 sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group);
742} 742}
743 743
744void input_register_device(struct input_dev *dev) 744int input_register_device(struct input_dev *dev)
745{ 745{
746 struct input_handle *handle; 746 struct input_handle *handle;
747 struct input_handler *handler; 747 struct input_handler *handler;
748 struct input_device_id *id; 748 struct input_device_id *id;
749 749
750 set_bit(EV_SYN, dev->evbit); 750 if (!dev->dynalloc) {
751 printk(KERN_WARNING "input: device %s is statically allocated, will not register\n"
752 "Please convert to input_allocate_device() or contact dtor_core@ameritech.net\n",
753 dev->name ? dev->name : "<Unknown>");
754 return -EINVAL;
755 }
751 756
752 init_MUTEX(&dev->sem); 757 init_MUTEX(&dev->sem);
758 set_bit(EV_SYN, dev->evbit);
753 759
754 /* 760 /*
755 * If delay and period are pre-set by the driver, then autorepeating 761 * If delay and period are pre-set by the driver, then autorepeating
@@ -767,8 +773,7 @@ void input_register_device(struct input_dev *dev)
767 INIT_LIST_HEAD(&dev->h_list); 773 INIT_LIST_HEAD(&dev->h_list);
768 list_add_tail(&dev->node, &input_dev_list); 774 list_add_tail(&dev->node, &input_dev_list);
769 775
770 if (dev->dynalloc) 776 input_register_classdevice(dev);
771 input_register_classdevice(dev);
772 777
773 list_for_each_entry(handler, &input_handler_list, node) 778 list_for_each_entry(handler, &input_handler_list, node)
774 if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) 779 if (!handler->blacklist || !input_match_device(handler->blacklist, dev))
@@ -776,8 +781,9 @@ void input_register_device(struct input_dev *dev)
776 if ((handle = handler->connect(handler, dev, id))) 781 if ((handle = handler->connect(handler, dev, id)))
777 input_link_handle(handle); 782 input_link_handle(handle);
778 783
779
780 input_wakeup_procfs_readers(); 784 input_wakeup_procfs_readers();
785
786 return 0;
781} 787}
782 788
783void input_unregister_device(struct input_dev *dev) 789void input_unregister_device(struct input_dev *dev)
@@ -797,11 +803,9 @@ void input_unregister_device(struct input_dev *dev)
797 803
798 list_del_init(&dev->node); 804 list_del_init(&dev->node);
799 805
800 if (dev->dynalloc) { 806 sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group);
801 sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group); 807 sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group);
802 sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); 808 class_device_unregister(&dev->cdev);
803 class_device_unregister(&dev->cdev);
804 }
805 809
806 input_wakeup_procfs_readers(); 810 input_wakeup_procfs_readers();
807} 811}