summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2004-07-27 14:55:34 -0500
committerDmitry Torokhov <dtor_core@ameritech.net>2004-07-27 14:55:34 -0500
commite144c08e2d3399d6471d824462071a35cfc8377c (patch)
tree3831e49a5c45f26f9daca517938f474e72f29f9a /drivers/input
parent41b701f97ecd330aba7898b60ddc62ccfecb8659 (diff)
Input: fix reader wakeup conditions in mousedev, joydev and tsdev
(we want readers to wake up when underlying device is gone so they would get -ENODEV and close the device). Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/joydev.c6
-rw-r--r--drivers/input/mousedev.c6
-rw-r--r--drivers/input/tsdev.c10
3 files changed, 14 insertions, 8 deletions
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 5eb884656db8..3e47218e0d6a 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -232,8 +232,10 @@ static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, lo
&& list->head == list->tail && (file->f_flags & O_NONBLOCK))
return -EAGAIN;
- retval = wait_event_interruptible(list->joydev->wait, list->joydev->exist
- && (list->startup < joydev->nabs + joydev->nkey || list->head != list->tail));
+ retval = wait_event_interruptible(list->joydev->wait,
+ !list->joydev->exist ||
+ list->startup < joydev->nabs + joydev->nkey ||
+ list->head != list->tail);
if (retval)
return retval;
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 7aeed6fcfc5a..e1dc39a8a2d8 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -524,11 +524,15 @@ static ssize_t mousedev_read(struct file * file, char __user * buffer, size_t co
if (!list->ready && !list->buffer && (file->f_flags & O_NONBLOCK))
return -EAGAIN;
- retval = wait_event_interruptible(list->mousedev->wait, list->ready || list->buffer);
+ retval = wait_event_interruptible(list->mousedev->wait,
+ !list->mousedev->exist || list->ready || list->buffer);
if (retval)
return retval;
+ if (!list->mousedev->exist)
+ return -ENODEV;
+
if (!list->buffer && list->ready) {
mousedev_packet(list, list->ps2);
list->buffer = list->bufsiz;
diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c
index 762878cf3d0c..7acacb3c6894 100644
--- a/drivers/input/tsdev.c
+++ b/drivers/input/tsdev.c
@@ -19,18 +19,18 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ *
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <jsimmons@infradead.org>.
*/
@@ -210,7 +210,7 @@ static ssize_t tsdev_read(struct file *file, char __user *buffer, size_t count,
return -EAGAIN;
retval = wait_event_interruptible(list->tsdev->wait,
- (list->head != list->tail) && list->tsdev->exist);
+ list->head != list->tail || !list->tsdev->exist);
if (retval)
return retval;