Commit 915e5473 authored by Andy Walls's avatar Andy Walls Committed by Mauro Carvalho Chehab

[media] lirc_zilog: Don't acquire the rx->buf_lock in the poll() function

There is no need to take the rx->buf_lock in the the poll() function
as all the underling calls made on objects in the rx->buf lirc_buffer object
are protected by spinlocks.

Corrected a bad error return value in poll(): return POLLERR instead
of -ENODEV.

Added some comments to poll() for when, in the future, I forget what
poll() and poll_wait() are supposed to do.

[Jarod: minor debug spew fix]
Signed-off-by: default avatarAndy Walls <awalls@md.metrocast.net>
Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 9a55a2b3
...@@ -985,19 +985,26 @@ static unsigned int poll(struct file *filep, poll_table *wait) ...@@ -985,19 +985,26 @@ static unsigned int poll(struct file *filep, poll_table *wait)
unsigned int ret; unsigned int ret;
dprintk("poll called\n"); dprintk("poll called\n");
if (rx == NULL)
return -ENODEV;
mutex_lock(&rx->buf_lock); if (rx == NULL) {
/*
* Revisit this, if our poll function ever reports writeable
* status for Tx
*/
dprintk("poll result = POLLERR\n");
return POLLERR;
}
/*
* Add our lirc_buffer's wait_queue to the poll_table. A wake up on
* that buffer's wait queue indicates we may have a new poll status.
*/
poll_wait(filep, &rx->buf.wait_poll, wait); poll_wait(filep, &rx->buf.wait_poll, wait);
dprintk("poll result = %s\n", /* Indicate what ops could happen immediately without blocking */
lirc_buffer_empty(&rx->buf) ? "0" : "POLLIN|POLLRDNORM");
ret = lirc_buffer_empty(&rx->buf) ? 0 : (POLLIN|POLLRDNORM); ret = lirc_buffer_empty(&rx->buf) ? 0 : (POLLIN|POLLRDNORM);
mutex_unlock(&rx->buf_lock); dprintk("poll result = %s\n", ret ? "POLLIN|POLLRDNORM" : "none");
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment