int i = iminor(inode) - EVDEV_MINOR_BASE;
int accept_err;
- if (i >= EVDEV_MINORS || !evdev_table[i])
+ if (i >= EVDEV_MINORS || !evdev_table[i] || !evdev_table[i]->exist)
return -ENODEV;
if ((accept_err = input_accept_process(&(evdev_table[i]->handle), file)))
return -EAGAIN;
retval = wait_event_interruptible(list->evdev->wait,
- list->head != list->tail && list->evdev->exist);
+ list->head != list->tail || (!list->evdev->exist));
if (retval)
return retval;
case EVIOCGID:
return copy_to_user(p, &dev->id, sizeof(struct input_id)) ? -EFAULT : 0;
-
+
case EVIOCGKEYCODE:
if (get_user(t, ip)) return -EFAULT;
if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL;
devfs_mk_cdev(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor),
S_IFCHR|S_IRUGO|S_IWUSR, "input/event%d", minor);
- class_simple_device_add(input_class,
+ class_simple_device_add(input_class,
MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor),
dev->dev, "event%d", minor);