aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/evdev.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-09-09 21:14:47 -0400
committerDmitry Torokhov <dtor_core@ameritech.net>2005-09-09 21:14:47 -0400
commitd344c5e0856ad03278d8700b503762dbc8b86e12 (patch)
treea6d893a643470a3c2580a58f3228a55fa1fd1d82 /drivers/input/evdev.c
parent010988e888a0abbe7118635c1b33d049caae6b29 (diff)
parent87fc767b832ef5a681a0ff9d203c3289bc3be2bf (diff)
Manual merge with Linus
Diffstat (limited to 'drivers/input/evdev.c')
-rw-r--r--drivers/input/evdev.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 3a8314bb7902..3738d173f9a6 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -160,6 +160,8 @@ struct input_event_compat {
160# define COMPAT_TEST IS_IA32_PROCESS(ia64_task_regs(current)) 160# define COMPAT_TEST IS_IA32_PROCESS(ia64_task_regs(current))
161#elif defined(CONFIG_ARCH_S390) 161#elif defined(CONFIG_ARCH_S390)
162# define COMPAT_TEST test_thread_flag(TIF_31BIT) 162# define COMPAT_TEST test_thread_flag(TIF_31BIT)
163#elif defined(CONFIG_MIPS)
164# define COMPAT_TEST (current->thread.mflags & MF_32BIT_ADDR)
163#else 165#else
164# define COMPAT_TEST test_thread_flag(TIF_32BIT) 166# define COMPAT_TEST test_thread_flag(TIF_32BIT)
165#endif 167#endif
@@ -391,6 +393,7 @@ static long evdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
391 case EV_LED: bits = dev->ledbit; len = LED_MAX; break; 393 case EV_LED: bits = dev->ledbit; len = LED_MAX; break;
392 case EV_SND: bits = dev->sndbit; len = SND_MAX; break; 394 case EV_SND: bits = dev->sndbit; len = SND_MAX; break;
393 case EV_FF: bits = dev->ffbit; len = FF_MAX; break; 395 case EV_FF: bits = dev->ffbit; len = FF_MAX; break;
396 case EV_SW: bits = dev->swbit; len = SW_MAX; break;
394 default: return -EINVAL; 397 default: return -EINVAL;
395 } 398 }
396 len = NBITS(len) * sizeof(long); 399 len = NBITS(len) * sizeof(long);
@@ -419,6 +422,13 @@ static long evdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
419 return copy_to_user(p, dev->snd, len) ? -EFAULT : len; 422 return copy_to_user(p, dev->snd, len) ? -EFAULT : len;
420 } 423 }
421 424
425 if (_IOC_NR(cmd) == _IOC_NR(EVIOCGSW(0))) {
426 int len;
427 len = NBITS(SW_MAX) * sizeof(long);
428 if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);
429 return copy_to_user(p, dev->sw, len) ? -EFAULT : len;
430 }
431
422 if (_IOC_NR(cmd) == _IOC_NR(EVIOCGNAME(0))) { 432 if (_IOC_NR(cmd) == _IOC_NR(EVIOCGNAME(0))) {
423 int len; 433 int len;
424 if (!dev->name) return -ENOENT; 434 if (!dev->name) return -ENOENT;
@@ -499,7 +509,7 @@ do { \
499 int len = NBITS_COMPAT((max)) * sizeof(compat_long_t); \ 509 int len = NBITS_COMPAT((max)) * sizeof(compat_long_t); \
500 if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); \ 510 if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); \
501 for (i = 0; i < len / sizeof(compat_long_t); i++) \ 511 for (i = 0; i < len / sizeof(compat_long_t); i++) \
502 if (copy_to_user((compat_long_t*) p + i, \ 512 if (copy_to_user((compat_long_t __user *) p + i, \
503 (compat_long_t*) (bit) + i + 1 - ((i % 2) << 1), \ 513 (compat_long_t*) (bit) + i + 1 - ((i % 2) << 1), \
504 sizeof(compat_long_t))) \ 514 sizeof(compat_long_t))) \
505 return -EFAULT; \ 515 return -EFAULT; \