summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Winkler2015-07-26 08:54:21 +0200
committerGreg Kroah-Hartman2015-08-04 02:30:00 +0200
commit2c84c2970c1acf83827aa97ab0e6addc3d2aa960 (patch)
tree8567095ee4121b333aea84a63d3a1e8f2cf36584
parentmei: add async event notification ioctls (diff)
downloadkernel-qcow2-linux-2c84c2970c1acf83827aa97ab0e6addc3d2aa960.tar.gz
kernel-qcow2-linux-2c84c2970c1acf83827aa97ab0e6addc3d2aa960.tar.xz
kernel-qcow2-linux-2c84c2970c1acf83827aa97ab0e6addc3d2aa960.zip
mei: support polling for event notification
Polling on priority events is translated on waiting for event notification. One need to enable notification prior for calling select or poll system call otherwise process will not wait. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/misc/mei/main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index ffa70035af29..17b356f26686 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -608,6 +608,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait)
struct mei_cl *cl = file->private_data;
struct mei_device *dev;
unsigned int mask = 0;
+ bool notify_en;
if (WARN_ON(!cl || !cl->dev))
return POLLERR;
@@ -616,6 +617,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait)
mutex_lock(&dev->device_lock);
+ notify_en = cl->notify_en && (req_events & POLLPRI);
if (dev->dev_state != MEI_DEV_ENABLED ||
!mei_cl_is_connected(cl)) {
@@ -628,6 +630,12 @@ static unsigned int mei_poll(struct file *file, poll_table *wait)
goto out;
}
+ if (notify_en) {
+ poll_wait(file, &cl->ev_wait, wait);
+ if (cl->notify_ev)
+ mask |= POLLPRI;
+ }
+
if (req_events & (POLLIN | POLLRDNORM)) {
poll_wait(file, &cl->rx_wait, wait);