aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2012-11-11 10:38:02 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-15 18:34:18 -0500
commit744f0f2f424d374b233cea5f9b34caa851543755 (patch)
tree44a752a23b215fdbe390646aa5ab2f25025eb8ee /drivers/misc
parenta562d5c25aa48c23774ab8d60bfd3bbcbca4bf1d (diff)
mei: extract amthif specific code from mei_poll to mei_amthif_poll
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/mei/amthif.c19
-rw-r--r--drivers/misc/mei/main.c10
-rw-r--r--drivers/misc/mei/mei_dev.h6
3 files changed, 25 insertions, 10 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index 8f4373aa9e24..7416241dce88 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)
401 } 401 }
402} 402}
403 403
404
405unsigned int mei_amthif_poll(struct mei_device *dev,
406 struct file *file, poll_table *wait)
407{
408 unsigned int mask = 0;
409 mutex_unlock(&dev->device_lock);
410 poll_wait(file, &dev->iamthif_cl.wait, wait);
411 mutex_lock(&dev->device_lock);
412 if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE &&
413 dev->iamthif_file_object == file) {
414 mask |= (POLLIN | POLLRDNORM);
415 dev_dbg(&dev->pdev->dev, "run next amthi cb\n");
416 mei_amthif_run_next_cmd(dev);
417 }
418 return mask;
419}
420
421
422
404/** 423/**
405 * mei_amthif_irq_process_completed - processes completed iamthif operation. 424 * mei_amthif_irq_process_completed - processes completed iamthif operation.
406 * 425 *
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 43512e517952..2cc1ebb131ba 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)
694 694
695 695
696 if (cl == &dev->iamthif_cl) { 696 if (cl == &dev->iamthif_cl) {
697 mutex_unlock(&dev->device_lock); 697 mask = mei_amthif_poll(dev, file, wait);
698 poll_wait(file, &dev->iamthif_cl.wait, wait);
699 mutex_lock(&dev->device_lock);
700 if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE &&
701 dev->iamthif_file_object == file) {
702 mask |= (POLLIN | POLLRDNORM);
703 dev_dbg(&dev->pdev->dev, "run next amthi cb\n");
704 mei_amthif_run_next_cmd(dev);
705 }
706 goto out; 698 goto out;
707 } 699 }
708 700
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index bdad35e7aa54..dad85f3fe390 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -19,6 +19,7 @@
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/watchdog.h> 21#include <linux/watchdog.h>
22#include <linux/poll.h>
22#include <linux/mei.h> 23#include <linux/mei.h>
23#include "hw.h" 24#include "hw.h"
24 25
@@ -387,7 +388,10 @@ void mei_amthif_host_init(struct mei_device *dev);
387int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *priv_cb); 388int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *priv_cb);
388 389
389int mei_amthif_read(struct mei_device *dev, struct file *file, 390int mei_amthif_read(struct mei_device *dev, struct file *file,
390 char __user *ubuf, size_t length, loff_t *offset); 391 char __user *ubuf, size_t length, loff_t *offset);
392
393unsigned int mei_amthif_poll(struct mei_device *dev,
394 struct file *file, poll_table *wait);
391 395
392int mei_amthif_release(struct mei_device *dev, struct file *file); 396int mei_amthif_release(struct mei_device *dev, struct file *file);
393 397