提交 2c84c297 编写于 作者: T Tomas Winkler 提交者: Greg Kroah-Hartman

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: NTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: NAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 3c7c8468
...@@ -608,6 +608,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait) ...@@ -608,6 +608,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait)
struct mei_cl *cl = file->private_data; struct mei_cl *cl = file->private_data;
struct mei_device *dev; struct mei_device *dev;
unsigned int mask = 0; unsigned int mask = 0;
bool notify_en;
if (WARN_ON(!cl || !cl->dev)) if (WARN_ON(!cl || !cl->dev))
return POLLERR; return POLLERR;
...@@ -616,6 +617,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait) ...@@ -616,6 +617,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait)
mutex_lock(&dev->device_lock); mutex_lock(&dev->device_lock);
notify_en = cl->notify_en && (req_events & POLLPRI);
if (dev->dev_state != MEI_DEV_ENABLED || if (dev->dev_state != MEI_DEV_ENABLED ||
!mei_cl_is_connected(cl)) { !mei_cl_is_connected(cl)) {
...@@ -628,6 +630,12 @@ static unsigned int mei_poll(struct file *file, poll_table *wait) ...@@ -628,6 +630,12 @@ static unsigned int mei_poll(struct file *file, poll_table *wait)
goto out; goto out;
} }
if (notify_en) {
poll_wait(file, &cl->ev_wait, wait);
if (cl->notify_ev)
mask |= POLLPRI;
}
if (req_events & (POLLIN | POLLRDNORM)) { if (req_events & (POLLIN | POLLRDNORM)) {
poll_wait(file, &cl->rx_wait, wait); poll_wait(file, &cl->rx_wait, wait);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册