提交 744f0f2f 编写于 作者: T Tomas Winkler 提交者: Greg Kroah-Hartman

mei: extract amthif specific code from mei_poll to mei_amthif_poll

Signed-off-by: NTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 a562d5c2
...@@ -401,6 +401,25 @@ void mei_amthif_run_next_cmd(struct mei_device *dev) ...@@ -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. * mei_amthif_irq_process_completed - processes completed iamthif operation.
* *
......
...@@ -694,15 +694,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait) ...@@ -694,15 +694,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait)
if (cl == &dev->iamthif_cl) { if (cl == &dev->iamthif_cl) {
mutex_unlock(&dev->device_lock); mask = mei_amthif_poll(dev, file, wait);
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);
}
goto out; goto out;
} }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/watchdog.h> #include <linux/watchdog.h>
#include <linux/poll.h>
#include <linux/mei.h> #include <linux/mei.h>
#include "hw.h" #include "hw.h"
...@@ -387,7 +388,10 @@ void mei_amthif_host_init(struct mei_device *dev); ...@@ -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_write(struct mei_device *dev, struct mei_cl_cb *priv_cb);
int mei_amthif_read(struct mei_device *dev, struct file *file, 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); int mei_amthif_release(struct mei_device *dev, struct file *file);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册