From: Tomas Winkler <tomas.winkler@intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: arnd@arndb.de, Alexander Usyskin <alexander.usyskin@intel.com>,
linux-kernel@vger.kernel.org,
Tomas Winkler <tomas.winkler@intel.com>
Subject: [char-misc-next 7/9 RESEND] mei: support polling for event notification
Date: Sun, 26 Jul 2015 09:54:21 +0300 [thread overview]
Message-ID: <1437893663-2068-8-git-send-email-tomas.winkler@intel.com> (raw)
In-Reply-To: <1437893663-2068-1-git-send-email-tomas.winkler@intel.com>
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
next prev parent reply other threads:[~2015-07-26 6:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-26 6:54 [char-misc-next 0/9 RESEND] mei: support for async event notifications Tomas Winkler
2015-07-26 6:54 ` [char-misc-next 1/9 RESEND] mei: define async notification hbm commands Tomas Winkler
2015-07-26 6:54 ` [char-misc-next 2/9 RESEND] mei: implement async notification hbm messages Tomas Winkler
2015-07-26 6:54 ` [char-misc-next 3/9 RESEND] mei: enable async event notifications only from hbm version 2.0 Tomas Winkler
2015-07-26 6:54 ` [char-misc-next 4/9 RESEND] mei: add mei_cl_notify_request command Tomas Winkler
2015-07-26 6:54 ` [char-misc-next 5/9 RESEND] mei: add a handler that waits for notification on event Tomas Winkler
2015-07-26 6:54 ` [char-misc-next 6/9 RESEND] mei: add async event notification ioctls Tomas Winkler
2015-07-26 6:54 ` Tomas Winkler [this message]
2015-07-26 6:54 ` [char-misc-next 8/9 RESEND] mei: implement fasync for event notification Tomas Winkler
2015-07-26 6:54 ` [char-misc-next 9/9 RESEND] mei: bus: add and call callback on notify event Tomas Winkler
2015-07-26 17:45 ` [char-misc-next 0/9 RESEND] mei: support for async event notifications Greg Kroah-Hartman
2015-07-27 6:36 ` Winkler, Tomas
2015-08-04 0:18 ` Greg Kroah-Hartman
2015-08-04 10:59 ` Winkler, Tomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1437893663-2068-8-git-send-email-tomas.winkler@intel.com \
--to=tomas.winkler@intel.com \
--cc=alexander.usyskin@intel.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®