summaryrefslogtreecommitdiff
path: root/drivers/input/evdev.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-01-20 12:10:09 +0100
committerTakashi Iwai <tiwai@suse.de>2012-01-20 12:10:09 +0100
commiteefad7fd53eae2eb8d1e205b1d3a18f67e4e6b46 (patch)
tree497ef1a21d90c63ac2e4ca6389c0844d0d72b0a8 /drivers/input/evdev.c
parentb9ecc4ee28a5ff5b3997da247cd9df1320c602a9 (diff)
parentac9ef6cf9196107115930e9fc66207199ef395b3 (diff)
Merge branch 'topic/convert-bint' into topic/hda
Merge the conversions to bint module option type.
Diffstat (limited to 'drivers/input/evdev.c')
-rw-r--r--drivers/input/evdev.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 4cf25347b015..76457d50bc34 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -369,7 +369,7 @@ static int evdev_fetch_next_event(struct evdev_client *client,
spin_lock_irq(&client->buffer_lock);
- have_event = client->head != client->tail;
+ have_event = client->packet_head != client->tail;
if (have_event) {
*event = client->buffer[client->tail++];
client->tail &= client->bufsize - 1;
@@ -391,14 +391,13 @@ static ssize_t evdev_read(struct file *file, char __user *buffer,
if (count < input_event_size())
return -EINVAL;
- if (client->packet_head == client->tail && evdev->exist &&
- (file->f_flags & O_NONBLOCK))
- return -EAGAIN;
-
- retval = wait_event_interruptible(evdev->wait,
- client->packet_head != client->tail || !evdev->exist);
- if (retval)
- return retval;
+ if (!(file->f_flags & O_NONBLOCK)) {
+ retval = wait_event_interruptible(evdev->wait,
+ client->packet_head != client->tail ||
+ !evdev->exist);
+ if (retval)
+ return retval;
+ }
if (!evdev->exist)
return -ENODEV;
@@ -412,6 +411,9 @@ static ssize_t evdev_read(struct file *file, char __user *buffer,
retval += input_event_size();
}
+ if (retval == 0 && (file->f_flags & O_NONBLOCK))
+ return -EAGAIN;
+
return retval;
}