mei: extract amthif specific code from mei_poll to mei_amthif_poll
authorTomas Winkler <tomas.winkler@intel.com>
Sun, 11 Nov 2012 15:38:02 +0000 (17:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Nov 2012 23:34:18 +0000 (15:34 -0800)
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/amthif.c
drivers/misc/mei/main.c
drivers/misc/mei/mei_dev.h

index 8f4373aa9e24034a1fc5de2059b282edebdb6ec2..7416241dce880df8d6a02160b950932a81642d38 100644 (file)
@@ -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.
  *
index 43512e5179522a5d283ab1b4bc6a599d7874be19..2cc1ebb131ba40b5afd046adef536d237fbe4b29 100644 (file)
@@ -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;
        }
 
index bdad35e7aa54db5b725df9f72b1c906406ddb271..dad85f3fe390d347a3578bd7a5a3fee1321739d8 100644 (file)
@@ -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);