From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752193AbbFXJCI (ORCPT ); Wed, 24 Jun 2015 05:02:08 -0400 Received: from mga01.intel.com ([192.55.52.88]:65342 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752006AbbFXJAz (ORCPT ); Wed, 24 Jun 2015 05:00:55 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,671,1427785200"; d="scan'208";a="593795252" From: Tomas Winkler To: gregkh@linuxfoundation.org Cc: arnd@arndb.de, linux-kernel@vger.kernel.org, Tomas Winkler , Alexander Usyskin Subject: [char-misc-next 7/9] mei: support polling for event notification Date: Wed, 24 Jun 2015 11:59:29 +0300 Message-Id: <1435136371-7248-8-git-send-email-tomas.winkler@intel.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1435136371-7248-1-git-send-email-tomas.winkler@intel.com> References: <1435136371-7248-1-git-send-email-tomas.winkler@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Alexander Usyskin --- 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 4a3f72986ecb..79892a480de5 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c @@ -607,6 +607,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; @@ -615,6 +616,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)) { @@ -627,6 +629,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