aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/mei/main.c')
-rw-r--r--drivers/misc/mei/main.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index d80867e0d803..a1ec45054988 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -542,6 +542,7 @@ static long mei_compat_ioctl(struct file *file,
542 */ 542 */
543static unsigned int mei_poll(struct file *file, poll_table *wait) 543static unsigned int mei_poll(struct file *file, poll_table *wait)
544{ 544{
545 unsigned long req_events = poll_requested_events(wait);
545 struct mei_cl *cl = file->private_data; 546 struct mei_cl *cl = file->private_data;
546 struct mei_device *dev; 547 struct mei_device *dev;
547 unsigned int mask = 0; 548 unsigned int mask = 0;
@@ -558,22 +559,19 @@ static unsigned int mei_poll(struct file *file, poll_table *wait)
558 goto out; 559 goto out;
559 } 560 }
560 561
561 mutex_unlock(&dev->device_lock); 562 if (cl == &dev->iamthif_cl) {
562 563 mask = mei_amthif_poll(dev, file, wait);
563
564 if (cl == &dev->iamthif_cl)
565 return mei_amthif_poll(dev, file, wait);
566
567 poll_wait(file, &cl->tx_wait, wait);
568
569 mutex_lock(&dev->device_lock);
570
571 if (!mei_cl_is_connected(cl)) {
572 mask = POLLERR;
573 goto out; 564 goto out;
574 } 565 }
575 566
576 mask |= (POLLIN | POLLRDNORM); 567 if (req_events & (POLLIN | POLLRDNORM)) {
568 poll_wait(file, &cl->rx_wait, wait);
569
570 if (!list_empty(&cl->rd_completed))
571 mask |= POLLIN | POLLRDNORM;
572 else
573 mei_cl_read_start(cl, 0, file);
574 }
577 575
578out: 576out:
579 mutex_unlock(&dev->device_lock); 577 mutex_unlock(&dev->device_lock);