summaryrefslogtreecommitdiff
path: root/drivers/input/evdev.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2010-08-02 20:18:21 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-08-02 20:30:04 -0700
commitd31b2865a4e8a9dd02f39e56c8fadb824c5e187b (patch)
treecbe062757aa54c88c8e9ae2bf6ff87f791313c60 /drivers/input/evdev.c
parent987a6c0298260b7aa40702b349282554d6180e4b (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.c21
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,
if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) {
t = _IOC_NR(cmd) & ABS_MAX;
-
- abs.value = input_abs_get_val(dev, t);
- abs.minimum = input_abs_get_min(dev, t);
- abs.maximum = input_abs_get_max(dev, t);
- abs.fuzz = input_abs_get_fuzz(dev, t);
- abs.flat = input_abs_get_flat(dev, t);
- abs.resolution = input_abs_get_res(dev, t);
+ abs = dev->absinfo[t];
if (copy_to_user(p, &abs, min_t(size_t,
_IOC_SIZE(cmd),
@@ -691,6 +685,9 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
sizeof(struct input_absinfo))))
return -EFAULT;
+ if (_IOC_SIZE(cmd) < sizeof(struct input_absinfo))
+ abs.resolution = 0;
+
/* We can't change number of reserved MT slots */
if (t == ABS_MT_SLOT)
return -EINVAL;
@@ -701,15 +698,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
* of event.
*/
spin_lock_irq(&dev->event_lock);
-
- input_abs_set_val(dev, t, abs.value);
- input_abs_set_min(dev, t, abs.minimum);
- input_abs_set_max(dev, t, abs.maximum);
- input_abs_set_fuzz(dev, t, abs.fuzz);
- input_abs_set_flat(dev, t, abs.flat);
- input_abs_set_res(dev, t, _IOC_SIZE(cmd) < sizeof(struct input_absinfo) ?
- 0 : abs.resolution);
-
+ dev->absinfo[t] = abs;
spin_unlock_irq(&dev->event_lock);
return 0;