mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
fs: introduce new ->get_poll_head and ->poll_mask methods
->get_poll_head returns the waitqueue that the poll operation is going to sleep on. Note that this means we can only use a single waitqueue for the poll, unlike some current drivers that use two waitqueues for different events. But now that we have keyed wakeups and heavily use those for poll there aren't that many good reason left to keep the multiple waitqueues, and if there are any ->poll is still around, the driver just won't support aio poll. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]>
This commit is contained in:
parent
9965ed174e
commit
3deb642f0d
5 changed files with 50 additions and 7 deletions
23
fs/select.c
23
fs/select.c
|
|
@ -34,6 +34,29 @@
|
|||
|
||||
#include <linux/uaccess.h>
|
||||
|
||||
__poll_t vfs_poll(struct file *file, struct poll_table_struct *pt)
|
||||
{
|
||||
if (file->f_op->poll) {
|
||||
return file->f_op->poll(file, pt);
|
||||
} else if (file_has_poll_mask(file)) {
|
||||
unsigned int events = poll_requested_events(pt);
|
||||
struct wait_queue_head *head;
|
||||
|
||||
if (pt && pt->_qproc) {
|
||||
head = file->f_op->get_poll_head(file, events);
|
||||
if (!head)
|
||||
return DEFAULT_POLLMASK;
|
||||
if (IS_ERR(head))
|
||||
return EPOLLERR;
|
||||
pt->_qproc(file, head, pt);
|
||||
}
|
||||
|
||||
return file->f_op->poll_mask(file, events);
|
||||
} else {
|
||||
return DEFAULT_POLLMASK;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(vfs_poll);
|
||||
|
||||
/*
|
||||
* Estimate expected accuracy in ns from a timeval.
|
||||
|
|
|
|||
Loading…
Reference in a new issue