OSDN Git Service

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 03344b3..a9d8716 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;
 }