diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2015-03-26 18:27:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-03 10:18:56 -0400 |
commit | 1d9013f09203c694e2cba478b05afc6484d55180 (patch) | |
tree | 5121a805e981d630719641d0872c893a6c64feb7 /drivers/misc/mei/main.c | |
parent | e1c0d82dab4a4605d3bd1968436f030dfed4a829 (diff) |
mei: fix mei_poll operation
mei_poll returned with POLLIN w/o checking whether the operation
has really completed.
remove redundant check and locking in amthif specific handler
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/main.c')
-rw-r--r-- | drivers/misc/mei/main.c | 24 |
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 | */ |
543 | static unsigned int mei_poll(struct file *file, poll_table *wait) | 543 | static 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 | ||
578 | out: | 576 | out: |
579 | mutex_unlock(&dev->device_lock); | 577 | mutex_unlock(&dev->device_lock); |