瀏覽代碼

Input: evdev - signal that device is writable in evdev_poll()

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Dmitry Torokhov 15 年之前
父節點
當前提交
c18fb1396e
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      drivers/input/evdev.c

+ 7 - 2
drivers/input/evdev.c

@@ -403,10 +403,15 @@ static unsigned int evdev_poll(struct file *file, poll_table *wait)
 {
 	struct evdev_client *client = file->private_data;
 	struct evdev *evdev = client->evdev;
+	unsigned int mask;
 
 	poll_wait(file, &evdev->wait, wait);
-	return ((client->head == client->tail) ? 0 : (POLLIN | POLLRDNORM)) |
-		(evdev->exist ? 0 : (POLLHUP | POLLERR));
+
+	mask = evdev->exist ? POLLOUT | POLLWRNORM : POLLHUP | POLLERR;
+	if (client->head != client->tail)
+		mask |= POLLIN | POLLRDNORM;
+
+	return mask;
 }
 
 #ifdef CONFIG_COMPAT