aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/evdev.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-20 13:17:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-20 13:17:02 -0400
commit93db6294958f62643a917e44d1abc85440e600cf (patch)
tree33de2c41b0f70d209d64487d1a2bba6d673015ef /drivers/input/evdev.c
parent43813f399c72aa22e01a680559c1cb5274bf2140 (diff)
parenteef3e4cab72eaf5345e3c73b2975c194a714f6cd (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (35 commits) Input: add driver for Synaptics I2C touchpad Input: synaptics - add support for reporting x/y resolution Input: ALPS - handle touchpoints buttons correctly Input: gpio-keys - change timer to workqueue Input: ads7846 - pin change interrupt support Input: add support for touchscreen on W90P910 ARM platform Input: appletouch - improve finger detection Input: wacom - clear Intuos4 wheel data when finger leaves proximity Input: ucb1400 - move static function from header into core Input: add driver for EETI touchpanels Input: ads7846 - more detailed model name in sysfs Input: ads7846 - support swapping x and y axes Input: ati_remote2 - use non-atomic bitops Input: introduce lm8323 keypad driver Input: psmouse - ESD workaround fix for OLPC XO touchpad Input: tsc2007 - make sure platform provides get_pendown_state() Input: uinput - flush all pending ff effects before destroying device Input: simplify name handling for certain input handles Input: serio - do not use deprecated dev.power.power_state Input: wacom - add support for Intuos4 tablets ...
Diffstat (limited to 'drivers/input/evdev.c')
-rw-r--r--drivers/input/evdev.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 7a7a026ba712..114efd8dc8f5 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -25,7 +25,6 @@ struct evdev {
25 int exist; 25 int exist;
26 int open; 26 int open;
27 int minor; 27 int minor;
28 char name[16];
29 struct input_handle handle; 28 struct input_handle handle;
30 wait_queue_head_t wait; 29 wait_queue_head_t wait;
31 struct evdev_client *grab; 30 struct evdev_client *grab;
@@ -609,7 +608,8 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
609 p, compat_mode); 608 p, compat_mode);
610 609
611 if (_IOC_NR(cmd) == _IOC_NR(EVIOCGNAME(0))) 610 if (_IOC_NR(cmd) == _IOC_NR(EVIOCGNAME(0)))
612 return str_to_user(dev->name, _IOC_SIZE(cmd), p); 611 return str_to_user(dev_name(&evdev->dev),
612 _IOC_SIZE(cmd), p);
613 613
614 if (_IOC_NR(cmd) == _IOC_NR(EVIOCGPHYS(0))) 614 if (_IOC_NR(cmd) == _IOC_NR(EVIOCGPHYS(0)))
615 return str_to_user(dev->phys, _IOC_SIZE(cmd), p); 615 return str_to_user(dev->phys, _IOC_SIZE(cmd), p);
@@ -626,8 +626,11 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
626 abs.maximum = dev->absmax[t]; 626 abs.maximum = dev->absmax[t];
627 abs.fuzz = dev->absfuzz[t]; 627 abs.fuzz = dev->absfuzz[t];
628 abs.flat = dev->absflat[t]; 628 abs.flat = dev->absflat[t];
629 abs.resolution = dev->absres[t];
629 630
630 if (copy_to_user(p, &abs, sizeof(struct input_absinfo))) 631 if (copy_to_user(p, &abs, min_t(size_t,
632 _IOC_SIZE(cmd),
633 sizeof(struct input_absinfo))))
631 return -EFAULT; 634 return -EFAULT;
632 635
633 return 0; 636 return 0;
@@ -654,8 +657,9 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
654 657
655 t = _IOC_NR(cmd) & ABS_MAX; 658 t = _IOC_NR(cmd) & ABS_MAX;
656 659
657 if (copy_from_user(&abs, p, 660 if (copy_from_user(&abs, p, min_t(size_t,
658 sizeof(struct input_absinfo))) 661 _IOC_SIZE(cmd),
662 sizeof(struct input_absinfo))))
659 return -EFAULT; 663 return -EFAULT;
660 664
661 /* 665 /*
@@ -670,6 +674,8 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
670 dev->absmax[t] = abs.maximum; 674 dev->absmax[t] = abs.maximum;
671 dev->absfuzz[t] = abs.fuzz; 675 dev->absfuzz[t] = abs.fuzz;
672 dev->absflat[t] = abs.flat; 676 dev->absflat[t] = abs.flat;
677 dev->absres[t] = _IOC_SIZE(cmd) < sizeof(struct input_absinfo) ?
678 0 : abs.resolution;
673 679
674 spin_unlock_irq(&dev->event_lock); 680 spin_unlock_irq(&dev->event_lock);
675 681
@@ -807,16 +813,15 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
807 mutex_init(&evdev->mutex); 813 mutex_init(&evdev->mutex);
808 init_waitqueue_head(&evdev->wait); 814 init_waitqueue_head(&evdev->wait);
809 815
810 snprintf(evdev->name, sizeof(evdev->name), "event%d", minor); 816 dev_set_name(&evdev->dev, "event%d", minor);
811 evdev->exist = 1; 817 evdev->exist = 1;
812 evdev->minor = minor; 818 evdev->minor = minor;
813 819
814 evdev->handle.dev = input_get_device(dev); 820 evdev->handle.dev = input_get_device(dev);
815 evdev->handle.name = evdev->name; 821 evdev->handle.name = dev_name(&evdev->dev);
816 evdev->handle.handler = handler; 822 evdev->handle.handler = handler;
817 evdev->handle.private = evdev; 823 evdev->handle.private = evdev;
818 824
819 dev_set_name(&evdev->dev, evdev->name);
820 evdev->dev.devt = MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor); 825 evdev->dev.devt = MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor);
821 evdev->dev.class = &input_class; 826 evdev->dev.class = &input_class;
822 evdev->dev.parent = &dev->dev; 827 evdev->dev.parent = &dev->dev;