Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 774dd5d9 authored by Axel Dyks's avatar Axel Dyks Committed by Mauro Carvalho Chehab
Browse files

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: default avatarAndreas Oberritter <obi@linuxtv.org>

Signed-off-by: default avatarAxel Dyks <xl@xlsigned.net>
Acked-by: default avatarAndreas Oberritter <obi@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent be4f4519
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -544,15 +544,19 @@ static unsigned int cinergyt2_poll (struct file *file, struct poll_table_struct
{
{
	struct dvb_device *dvbdev = file->private_data;
	struct dvb_device *dvbdev = file->private_data;
	struct cinergyt2 *cinergyt2 = dvbdev->priv;
	struct cinergyt2 *cinergyt2 = dvbdev->priv;
       unsigned int mask = 0;


	if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
	if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
		return -ERESTARTSYS;
		return -ERESTARTSYS;


	poll_wait(file, &cinergyt2->poll_wq, wait);
	poll_wait(file, &cinergyt2->poll_wq, wait);


       if (cinergyt2->pending_fe_events != 0)
	       mask |= (POLLIN | POLLRDNORM | POLLPRI);

	mutex_unlock(&cinergyt2->sem);
	mutex_unlock(&cinergyt2->sem);


	return (POLLIN | POLLRDNORM | POLLPRI);
       return mask;
}
}