diff options
Diffstat (limited to 'drivers/input/mousedev.c')
| -rw-r--r-- | drivers/input/mousedev.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index f34b22bce4ff..d8f68f77007b 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
| @@ -57,7 +57,6 @@ struct mousedev_hw_data { | |||
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | struct mousedev { | 59 | struct mousedev { |
| 60 | int exist; | ||
| 61 | int open; | 60 | int open; |
| 62 | int minor; | 61 | int minor; |
| 63 | struct input_handle handle; | 62 | struct input_handle handle; |
| @@ -66,6 +65,7 @@ struct mousedev { | |||
| 66 | spinlock_t client_lock; /* protects client_list */ | 65 | spinlock_t client_lock; /* protects client_list */ |
| 67 | struct mutex mutex; | 66 | struct mutex mutex; |
| 68 | struct device dev; | 67 | struct device dev; |
| 68 | bool exist; | ||
| 69 | 69 | ||
| 70 | struct list_head mixdev_node; | 70 | struct list_head mixdev_node; |
| 71 | int mixdev_open; | 71 | int mixdev_open; |
| @@ -765,10 +765,15 @@ static unsigned int mousedev_poll(struct file *file, poll_table *wait) | |||
| 765 | { | 765 | { |
| 766 | struct mousedev_client *client = file->private_data; | 766 | struct mousedev_client *client = file->private_data; |
| 767 | struct mousedev *mousedev = client->mousedev; | 767 | struct mousedev *mousedev = client->mousedev; |
| 768 | unsigned int mask; | ||
| 768 | 769 | ||
| 769 | poll_wait(file, &mousedev->wait, wait); | 770 | poll_wait(file, &mousedev->wait, wait); |
| 770 | return ((client->ready || client->buffer) ? (POLLIN | POLLRDNORM) : 0) | | 771 | |
| 771 | (mousedev->exist ? 0 : (POLLHUP | POLLERR)); | 772 | mask = mousedev->exist ? POLLOUT | POLLWRNORM : POLLHUP | POLLERR; |
| 773 | if (client->ready || client->buffer) | ||
| 774 | mask |= POLLIN | POLLRDNORM; | ||
| 775 | |||
| 776 | return mask; | ||
| 772 | } | 777 | } |
| 773 | 778 | ||
| 774 | static const struct file_operations mousedev_fops = { | 779 | static const struct file_operations mousedev_fops = { |
| @@ -802,7 +807,7 @@ static void mousedev_remove_chrdev(struct mousedev *mousedev) | |||
| 802 | static void mousedev_mark_dead(struct mousedev *mousedev) | 807 | static void mousedev_mark_dead(struct mousedev *mousedev) |
| 803 | { | 808 | { |
| 804 | mutex_lock(&mousedev->mutex); | 809 | mutex_lock(&mousedev->mutex); |
| 805 | mousedev->exist = 0; | 810 | mousedev->exist = false; |
| 806 | mutex_unlock(&mousedev->mutex); | 811 | mutex_unlock(&mousedev->mutex); |
| 807 | } | 812 | } |
| 808 | 813 | ||
| @@ -862,7 +867,7 @@ static struct mousedev *mousedev_create(struct input_dev *dev, | |||
| 862 | dev_set_name(&mousedev->dev, "mouse%d", minor); | 867 | dev_set_name(&mousedev->dev, "mouse%d", minor); |
| 863 | 868 | ||
| 864 | mousedev->minor = minor; | 869 | mousedev->minor = minor; |
| 865 | mousedev->exist = 1; | 870 | mousedev->exist = true; |
| 866 | mousedev->handle.dev = input_get_device(dev); | 871 | mousedev->handle.dev = input_get_device(dev); |
| 867 | mousedev->handle.name = dev_name(&mousedev->dev); | 872 | mousedev->handle.name = dev_name(&mousedev->dev); |
| 868 | mousedev->handle.handler = handler; | 873 | mousedev->handle.handler = handler; |
