aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mousedev.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-08-02 18:35:17 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-08-02 18:35:17 -0700
commitd01d0756f75e7a5b4b43764ad45b83c4340f11d6 (patch)
tree90db2ff7ccb35a8fdcf98366e6404afe1f845bc4 /drivers/input/mousedev.c
parentInput: xpad - add product ID for Hori Fighting Stick EX2 (diff)
parentInput: adp5588-keypad - fix NULL dereference in adp5588_gpio_add() (diff)
downloadlinux-dev-d01d0756f75e7a5b4b43764ad45b83c4340f11d6.tar.xz
linux-dev-d01d0756f75e7a5b4b43764ad45b83c4340f11d6.zip
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/input/mousedev.c')
-rw-r--r--drivers/input/mousedev.c15
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 {
};
struct mousedev {
- int exist;
int open;
int minor;
struct input_handle handle;
@@ -66,6 +65,7 @@ struct mousedev {
spinlock_t client_lock; /* protects client_list */
struct mutex mutex;
struct device dev;
+ bool exist;
struct list_head mixdev_node;
int mixdev_open;
@@ -765,10 +765,15 @@ static unsigned int mousedev_poll(struct file *file, poll_table *wait)
{
struct mousedev_client *client = file->private_data;
struct mousedev *mousedev = client->mousedev;
+ unsigned int mask;
poll_wait(file, &mousedev->wait, wait);
- return ((client->ready || client->buffer) ? (POLLIN | POLLRDNORM) : 0) |
- (mousedev->exist ? 0 : (POLLHUP | POLLERR));
+
+ mask = mousedev->exist ? POLLOUT | POLLWRNORM : POLLHUP | POLLERR;
+ if (client->ready || client->buffer)
+ mask |= POLLIN | POLLRDNORM;
+
+ return mask;
}
static const struct file_operations mousedev_fops = {
@@ -802,7 +807,7 @@ static void mousedev_remove_chrdev(struct mousedev *mousedev)
static void mousedev_mark_dead(struct mousedev *mousedev)
{
mutex_lock(&mousedev->mutex);
- mousedev->exist = 0;
+ mousedev->exist = false;
mutex_unlock(&mousedev->mutex);
}
@@ -862,7 +867,7 @@ static struct mousedev *mousedev_create(struct input_dev *dev,
dev_set_name(&mousedev->dev, "mouse%d", minor);
mousedev->minor = minor;
- mousedev->exist = 1;
+ mousedev->exist = true;
mousedev->handle.dev = input_get_device(dev);
mousedev->handle.name = dev_name(&mousedev->dev);
mousedev->handle.handler = handler;