aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 01:25:43 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 12:52:54 -0400
commit629b77a42c39c8b3c42a8cf5f5680f0406f8d43f (patch)
tree1f4d97255d27ac036e682b882f792afaf8c3ef53 /drivers/input
parent967ca692161d8c4e894932599592af8d62c0a895 (diff)
[PATCH] INPUT: Fix oops when accessing sysfs files of nested input devices
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/input.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index b0ede4cc72b7..0d570cf92dc2 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -642,17 +642,22 @@ static ssize_t input_dev_show_##name(struct class_device *dev, char *buf) \
642 up(&input_dev->sem); \ 642 up(&input_dev->sem); \
643 \ 643 \
644 return retval; \ 644 return retval; \
645} 645} \
646static CLASS_DEVICE_ATTR(name, S_IRUGO, input_dev_show_##name, NULL);
646 647
647INPUT_DEV_STRING_ATTR_SHOW(name); 648INPUT_DEV_STRING_ATTR_SHOW(name);
648INPUT_DEV_STRING_ATTR_SHOW(phys); 649INPUT_DEV_STRING_ATTR_SHOW(phys);
649INPUT_DEV_STRING_ATTR_SHOW(uniq); 650INPUT_DEV_STRING_ATTR_SHOW(uniq);
650 651
651static struct class_device_attribute input_dev_attrs[] = { 652static struct attribute *input_dev_attrs[] = {
652 __ATTR(name, S_IRUGO, input_dev_show_name, NULL), 653 &class_device_attr_name.attr,
653 __ATTR(phys, S_IRUGO, input_dev_show_phys, NULL), 654 &class_device_attr_phys.attr,
654 __ATTR(uniq, S_IRUGO, input_dev_show_uniq, NULL), 655 &class_device_attr_uniq.attr,
655 __ATTR_NULL 656 NULL
657};
658
659static struct attribute_group input_dev_group = {
660 .attrs = input_dev_attrs,
656}; 661};
657 662
658#define INPUT_DEV_ID_ATTR(name) \ 663#define INPUT_DEV_ID_ATTR(name) \
@@ -728,7 +733,6 @@ static void input_dev_release(struct class_device *class_dev)
728struct class input_dev_class = { 733struct class input_dev_class = {
729 .name = "input_dev", 734 .name = "input_dev",
730 .release = input_dev_release, 735 .release = input_dev_release,
731 .class_dev_attrs = input_dev_attrs,
732}; 736};
733 737
734struct input_dev *input_allocate_device(void) 738struct input_dev *input_allocate_device(void)
@@ -766,6 +770,7 @@ static void input_register_classdevice(struct input_dev *dev)
766 kfree(path); 770 kfree(path);
767 771
768 class_device_add(&dev->cdev); 772 class_device_add(&dev->cdev);
773 sysfs_create_group(&dev->cdev.kobj, &input_dev_group);
769 sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group); 774 sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group);
770 sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group); 775 sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group);
771} 776}