Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1192479

[char-misc-next 7/9 RESEND] mei: support polling for event notification

From Tomas Winkler <tomas.winkler@intel.com>
Newsgroups linux.kernel
Subject [char-misc-next 7/9 RESEND] mei: support polling for event notification
Date 2015-07-26 09:00 +0200
Message-ID <pQo4G-3U0-19@gated-at.bofh.it> (permalink)
References <pQo4G-3U0-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/misc/mei/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

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);
 
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[char-misc-next 0/9 RESEND] mei: support for async event notifications Tomas Winkler <tomas.winkler@intel.com> - 2015-07-26 09:00 +0200
  [char-misc-next 9/9 RESEND] mei: bus: add and call callback on notify event Tomas Winkler <tomas.winkler@intel.com> - 2015-07-26 09:00 +0200
  [char-misc-next 3/9 RESEND] mei: enable async event notifications only from hbm version 2.0 Tomas Winkler <tomas.winkler@intel.com> - 2015-07-26 09:00 +0200
  [char-misc-next 4/9 RESEND] mei: add mei_cl_notify_request command Tomas Winkler <tomas.winkler@intel.com> - 2015-07-26 09:00 +0200
  [char-misc-next 7/9 RESEND] mei: support polling for event notification Tomas Winkler <tomas.winkler@intel.com> - 2015-07-26 09:00 +0200
  [char-misc-next 5/9 RESEND] mei: add a handler that waits for notification on event Tomas Winkler <tomas.winkler@intel.com> - 2015-07-26 09:00 +0200
  Re: [char-misc-next 0/9 RESEND] mei: support for async event  notifications Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-08-04 02:20 +0200
    RE: [char-misc-next 0/9 RESEND] mei: support for async event  notifications "Winkler, Tomas" <tomas.winkler@intel.com> - 2015-08-04 13:10 +0200

csiph-web