From: Dyks, Axel (XL) Date: Sun, 11 Jun 2006 20:14:35 +0000 (-0300) Subject: V4L/DVB (4090): Fix cinergyt2_poll() to allow non-blocking IO on frontend X-Git-Tag: firefly_0821_release~35239^2~79 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=774dd5d9bdcbfe2efb3425e8a0be0b4d01a65c26;p=firefly-linux-kernel-4.4.55.git V4L/DVB (4090): Fix cinergyt2_poll() to allow non-blocking IO on frontend cinergyt2_poll()" shouldn't return (POLLIN | POLLRDNORM | POLLPRI) when there are no pending events. User space programs that do non-bocking IO using "select()" and/or "poll()" would otherwise produce high system load. Acked-by: Andreas Oberritter Signed-off-by: Axel Dyks Acked-by: Andreas Oberritter Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index c7e4134872d4..8cfdad6f50fb 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c @@ -544,15 +544,19 @@ static unsigned int cinergyt2_poll (struct file *file, struct poll_table_struct { struct dvb_device *dvbdev = file->private_data; struct cinergyt2 *cinergyt2 = dvbdev->priv; + unsigned int mask = 0; if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) return -ERESTARTSYS; poll_wait(file, &cinergyt2->poll_wq, wait); + if (cinergyt2->pending_fe_events != 0) + mask |= (POLLIN | POLLRDNORM | POLLPRI); + mutex_unlock(&cinergyt2->sem); - return (POLLIN | POLLRDNORM | POLLPRI); + return mask; }