diff options
author | Daniel Mack <daniel@caiaq.de> | 2010-08-02 23:18:21 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-08-02 23:30:04 -0400 |
commit | d31b2865a4e8a9dd02f39e56c8fadb824c5e187b (patch) | |
tree | cbe062757aa54c88c8e9ae2bf6ff87f791313c60 /drivers/input/evdev.c | |
parent | 987a6c0298260b7aa40702b349282554d6180e4b (diff) |
Input: dynamically allocate ABS information
As all callers are now changed to only use the input_abs_*() access
helpers, switching over to dynamically allocated ABS information is
easy. This reduces size of struct input_dev from 3152 to 1640 on
64 bit architectures.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/evdev.c')
-rw-r--r-- | drivers/input/evdev.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 9807c8ff6a84..08f48c03eec4 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -649,13 +649,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, | |||
649 | if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) { | 649 | if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) { |
650 | 650 | ||
651 | t = _IOC_NR(cmd) & ABS_MAX; | 651 | t = _IOC_NR(cmd) & ABS_MAX; |
652 | 652 | abs = dev->absinfo[t]; | |
653 | abs.value = input_abs_get_val(dev, t); | ||
654 | abs.minimum = input_abs_get_min(dev, t); | ||
655 | abs.maximum = input_abs_get_max(dev, t); | ||
656 | abs.fuzz = input_abs_get_fuzz(dev, t); | ||
657 | abs.flat = input_abs_get_flat(dev, t); | ||
658 | abs.resolution = input_abs_get_res(dev, t); | ||
659 | 653 | ||
660 | if (copy_to_user(p, &abs, min_t(size_t, | 654 | if (copy_to_user(p, &abs, min_t(size_t, |
661 | _IOC_SIZE(cmd), | 655 | _IOC_SIZE(cmd), |
@@ -691,6 +685,9 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, | |||
691 | sizeof(struct input_absinfo)))) | 685 | sizeof(struct input_absinfo)))) |
692 | return -EFAULT; | 686 | return -EFAULT; |
693 | 687 | ||
688 | if (_IOC_SIZE(cmd) < sizeof(struct input_absinfo)) | ||
689 | abs.resolution = 0; | ||
690 | |||
694 | /* We can't change number of reserved MT slots */ | 691 | /* We can't change number of reserved MT slots */ |
695 | if (t == ABS_MT_SLOT) | 692 | if (t == ABS_MT_SLOT) |
696 | return -EINVAL; | 693 | return -EINVAL; |
@@ -701,15 +698,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, | |||
701 | * of event. | 698 | * of event. |
702 | */ | 699 | */ |
703 | spin_lock_irq(&dev->event_lock); | 700 | spin_lock_irq(&dev->event_lock); |
704 | 701 | dev->absinfo[t] = abs; | |
705 | input_abs_set_val(dev, t, abs.value); | ||
706 | input_abs_set_min(dev, t, abs.minimum); | ||
707 | input_abs_set_max(dev, t, abs.maximum); | ||
708 | input_abs_set_fuzz(dev, t, abs.fuzz); | ||
709 | input_abs_set_flat(dev, t, abs.flat); | ||
710 | input_abs_set_res(dev, t, _IOC_SIZE(cmd) < sizeof(struct input_absinfo) ? | ||
711 | 0 : abs.resolution); | ||
712 | |||
713 | spin_unlock_irq(&dev->event_lock); | 702 | spin_unlock_irq(&dev->event_lock); |
714 | 703 | ||
715 | return 0; | 704 | return 0; |