input: evdev: if no events and non-block, return EAGAIN not 0
authorDima Zavin <dima@android.com>
Wed, 5 Oct 2011 05:31:48 +0000 (22:31 -0700)
committerDima Zavin <dima@android.com>
Wed, 5 Oct 2011 05:51:03 +0000 (22:51 -0700)
Change-Id: I5f0da721f74e5de111cffc7e7b375b72dd80e530
Signed-off-by: Dima Zavin <dima@android.com>
drivers/input/evdev.c

index 13a741ae6045f738c5548d0395ad85934b4ceb8e..10ae1c966a3512919148cbdbafbcf3c45e2e1e79 100644 (file)
@@ -426,6 +426,8 @@ static ssize_t evdev_read(struct file *file, char __user *buffer,
                retval += input_event_size();
        }
 
+       if (retval == 0 && file->f_flags & O_NONBLOCK)
+               retval = -EAGAIN;
        return retval;
 }