mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tomas Winkler <tomas.winkler@intel.com>
To: gregkh@linuxfoundation.org
Cc: arnd@arndb.de, alan@linux.intel.com,
	linux-kernel@vger.kernel.org,
	Tomas Winkler <tomas.winkler@intel.com>
Subject: [char-misc-next 5/7] mei: extract amthif specific code from mei_poll to mei_amthif_poll
Date: Sun, 11 Nov 2012 17:38:02 +0200	[thread overview]
Message-ID: <1352648284-8838-5-git-send-email-tomas.winkler@intel.com> (raw)
In-Reply-To: <1352648284-8838-1-git-send-email-tomas.winkler@intel.com>

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/amthif.c  |   19 +++++++++++++++++++
 drivers/misc/mei/main.c    |   10 +---------
 drivers/misc/mei/mei_dev.h |    6 +++++-
 3 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index 8f4373a..7416241 100644
--- a/drivers/misc/mei/amthif.c
+++ b/drivers/misc/mei/amthif.c
@@ -401,6 +401,25 @@ void mei_amthif_run_next_cmd(struct mei_device *dev)
 	}
 }
 
+
+unsigned int mei_amthif_poll(struct mei_device *dev,
+		struct file *file, poll_table *wait)
+{
+	unsigned int mask = 0;
+	mutex_unlock(&dev->device_lock);
+	poll_wait(file, &dev->iamthif_cl.wait, wait);
+	mutex_lock(&dev->device_lock);
+	if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE &&
+		dev->iamthif_file_object == file) {
+		mask |= (POLLIN | POLLRDNORM);
+		dev_dbg(&dev->pdev->dev, "run next amthi cb\n");
+		mei_amthif_run_next_cmd(dev);
+	}
+	return mask;
+}
+
+
+
 /**
  * mei_amthif_irq_process_completed - processes completed iamthif operation.
  *
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 43512e5..2cc1ebb 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -694,15 +694,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait)
 
 
 	if (cl == &dev->iamthif_cl) {
-		mutex_unlock(&dev->device_lock);
-		poll_wait(file, &dev->iamthif_cl.wait, wait);
-		mutex_lock(&dev->device_lock);
-		if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE &&
-			dev->iamthif_file_object == file) {
-			mask |= (POLLIN | POLLRDNORM);
-			dev_dbg(&dev->pdev->dev, "run next amthi cb\n");
-			mei_amthif_run_next_cmd(dev);
-		}
+		mask = mei_amthif_poll(dev, file, wait);
 		goto out;
 	}
 
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index bdad35e..dad85f3 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -19,6 +19,7 @@
 
 #include <linux/types.h>
 #include <linux/watchdog.h>
+#include <linux/poll.h>
 #include <linux/mei.h>
 #include "hw.h"
 
@@ -387,7 +388,10 @@ void mei_amthif_host_init(struct mei_device *dev);
 int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *priv_cb);
 
 int mei_amthif_read(struct mei_device *dev, struct file *file,
-	      char __user *ubuf, size_t length, loff_t *offset);
+		char __user *ubuf, size_t length, loff_t *offset);
+
+unsigned int mei_amthif_poll(struct mei_device *dev,
+		struct file *file, poll_table *wait);
 
 int mei_amthif_release(struct mei_device *dev, struct file *file);
 
-- 
1.7.4.4


  parent reply	other threads:[~2012-11-11 15:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-11 15:37 [char-misc-next 1/7] mei: amthif: prefix cb list with amthif Tomas Winkler
2012-11-11 15:37 ` [char-misc-next 2/7] mei: use type struct mei_cl *cl instead of void in struct mei_cb Tomas Winkler
2012-11-11 15:38 ` [char-misc-next 3/7] mei: rename enum mei_cb_major_types to enum mei_cb_file_ops Tomas Winkler
2012-11-11 15:38 ` [char-misc-next 4/7] mei: move amthif specific release code to amithif Tomas Winkler
2012-11-11 15:38 ` Tomas Winkler [this message]
2012-11-11 15:38 ` [char-misc-next 6/7] mei: use link and unlink terms for connecting ME and HOST client Tomas Winkler
2012-11-11 15:38 ` [char-misc-next 7/7] mei: use the same bus msg for connect and disconnect request Tomas Winkler

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=1352648284-8838-5-git-send-email-tomas.winkler@intel.com \
    --to=tomas.winkler@intel.com \
    --cc=alan@linux.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®