static unsigned int tsdev_poll(struct file *file, poll_table * wait)
{
struct tsdev_list *list = file->private_data;
-
poll_wait(file, &list->tsdev->wait, wait);
- if (list->head != list->tail)
- return POLLIN | POLLRDNORM;
- return 0;
+ return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) |
+ (list->tsdev->exist ? 0 : (POLLHUP | POLLERR));
}
static int tsdev_ioctl(struct inode *inode, struct file *file,
return retval;
}
-struct file_operations tsdev_fops = {
+static struct file_operations tsdev_fops = {
.owner = THIS_MODULE,
.open = tsdev_open,
.release = tsdev_release,
static void tsdev_disconnect(struct input_handle *handle)
{
struct tsdev *tsdev = handle->private;
+ struct tsdev_list *list;
class_simple_device_remove(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor));
devfs_remove("input/ts%d", tsdev->minor);
if (tsdev->open) {
input_close_device(handle);
wake_up_interruptible(&tsdev->wait);
+ list_for_each_entry(list, &tsdev->list, node)
+ kill_fasync(&list->fasync, SIGIO, POLL_HUP);
} else
tsdev_free(tsdev);
}