Input: evdev - if no events and non-block, return EAGAIN not 0
authorDima Zavin <dima@android.com>
Fri, 30 Dec 2011 23:16:44 +0000 (15:16 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 30 Dec 2011 23:26:35 +0000 (15:26 -0800)
Signed-off-by: Dima Zavin <dima@android.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/evdev.c

index 03344b3c7c15e6ee4135640039e55459a63da32f..a9d871651ce70e5a1f6288b2343b240e599de3b2 100644 (file)
@@ -412,6 +412,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;
 }