mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 07:01:23 +00:00
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>
This commit is contained in:
parent
987a6c0298
commit
d31b2865a4
3 changed files with 63 additions and 57 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue