summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorHolger Waechtler <devnull@localhost>2003-01-08 16:51:07 +0000
committerHolger Waechtler <devnull@localhost>2003-01-08 16:51:07 +0000
commitc968f1b52110e481ca9e183729b3a6ad6a2d3aeb (patch)
tree4c6754f4ce3a7c7017192971cce4a47892bbb6bc /linux
parent9b3d3cf6fad7c32c45bf4eb501daee377fcd3529 (diff)
downloadmediapointer-dvb-s2-c968f1b52110e481ca9e183729b3a6ad6a2d3aeb.tar.gz
mediapointer-dvb-s2-c968f1b52110e481ca9e183729b3a6ad6a2d3aeb.tar.bz2
apply optimisation patches suggested by Dr. Werner Fink <werner@suse.de>
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dmxdev.c71
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.c3
-rw-r--r--linux/drivers/media/dvb/ttpci/av7110.c71
3 files changed, 61 insertions, 84 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dmxdev.c b/linux/drivers/media/dvb/dvb-core/dmxdev.c
index af2da677a..92d58d5ea 100644
--- a/linux/drivers/media/dvb/dvb-core/dmxdev.c
+++ b/linux/drivers/media/dvb/dvb-core/dmxdev.c
@@ -975,43 +975,38 @@ static int dvb_demux_ioctl(struct inode *inode, struct file *file,
}
-static unsigned int dvb_demux_poll(struct file *file, poll_table *wait)
+static
+unsigned int dvb_demux_poll (struct file *file, poll_table *wait)
{
- dmxdev_filter_t *dmxdevfilter=dvb_dmxdev_file_to_filter(file);
+ dmxdev_filter_t *dmxdevfilter = dvb_dmxdev_file_to_filter(file);
+ unsigned int mask = 0;
if (!dmxdevfilter)
return -EINVAL;
- if (dmxdevfilter->state==DMXDEV_STATE_FREE)
- return 0;
-
- if (dmxdevfilter->buffer.error)
- return (POLLIN | POLLRDNORM | POLLPRI | POLLERR);
-
- if (dmxdevfilter->buffer.pread!=dmxdevfilter->buffer.pwrite)
- return (POLLIN | POLLRDNORM | POLLPRI);
+ poll_wait(file, &dmxdevfilter->buffer.queue, wait);
- if (dmxdevfilter->state!=DMXDEV_STATE_GO)
+ if (dmxdevfilter->state != DMXDEV_STATE_GO)
return 0;
- poll_wait(file, &dmxdevfilter->buffer.queue, wait);
-
- if (dmxdevfilter->state==DMXDEV_STATE_FREE)
+ if (dmxdevfilter->state == DMXDEV_STATE_FREE)
return 0;
if (dmxdevfilter->buffer.error)
- return (POLLIN | POLLRDNORM | POLLPRI | POLLERR);
+ mask |= (POLLIN | POLLRDNORM | POLLPRI | POLLERR);
- if (dmxdevfilter->buffer.pread!=dmxdevfilter->buffer.pwrite)
- return (POLLIN | POLLRDNORM | POLLPRI);
+ if (dmxdevfilter->buffer.pread != dmxdevfilter->buffer.pwrite)
+ mask |= (POLLIN | POLLRDNORM | POLLPRI);
- return 0;
+ return mask;
}
-static int dvb_demux_release(struct inode *inode, struct file *file)
+
+static
+int dvb_demux_release(struct inode *inode, struct file *file)
{
- dmxdev_filter_t *dmxdevfilter=dvb_dmxdev_file_to_filter(file);
- dmxdev_t *dmxdev=dmxdevfilter->dev;
+ dmxdev_filter_t *dmxdevfilter = dvb_dmxdev_file_to_filter(file);
+ dmxdev_t *dmxdev = dmxdevfilter->dev;
return dvb_dmxdev_filter_free(dmxdev, dmxdevfilter);
}
@@ -1063,41 +1058,39 @@ static int dvb_dvr_ioctl(struct inode *inode, struct file *file,
}
-static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait)
+static
+unsigned int dvb_dvr_poll (struct file *file, poll_table *wait)
{
- struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
- dmxdev_t *dmxdev=(dmxdev_t *) dvbdev->priv;
+ struct dvb_device *dvbdev = (struct dvb_device *) file->private_data;
+ dmxdev_t *dmxdev = (dmxdev_t *) dvbdev->priv;
+ unsigned int mask = 0;
dprintk ("function : %s\n", __FUNCTION__);
- if ((file->f_flags&O_ACCMODE)==O_RDONLY) {
- if (dmxdev->dvr_buffer.error)
- return (POLLIN | POLLRDNORM | POLLPRI | POLLERR);
+ poll_wait(file, &dmxdev->dvr_buffer.queue, wait);
- if (dmxdev->dvr_buffer.pread!=dmxdev->dvr_buffer.pwrite)
- return (POLLIN | POLLRDNORM | POLLPRI);
-
- poll_wait(file, &dmxdev->dvr_buffer.queue, wait);
-
+ if ((file->f_flags&O_ACCMODE) == O_RDONLY) {
if (dmxdev->dvr_buffer.error)
- return (POLLIN | POLLRDNORM | POLLPRI | POLLERR);
+ mask |= (POLLIN | POLLRDNORM | POLLPRI | POLLERR);
if (dmxdev->dvr_buffer.pread!=dmxdev->dvr_buffer.pwrite)
- return (POLLIN | POLLRDNORM | POLLPRI);
-
- return 0;
+ mask |= (POLLIN | POLLRDNORM | POLLPRI);
} else
- return (POLLOUT | POLLWRNORM | POLLPRI);
+ mask |= (POLLOUT | POLLWRNORM | POLLPRI);
+
+ return mask;
}
-static struct file_operations dvb_dvr_fops = {
+
+static
+struct file_operations dvb_dvr_fops = {
.owner = THIS_MODULE,
.read = dvb_dvr_read,
.write = dvb_dvr_write,
.ioctl = dvb_dvr_ioctl,
.open = dvb_dvr_open,
.release = dvb_dvr_release,
- .poll =dvb_dvr_poll,
+ .poll = dvb_dvr_poll,
};
static struct dvb_device dvbdev_dvr = {
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
index 1ccc5e187..7acab95e5 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -590,9 +590,6 @@ unsigned int dvb_frontend_poll (struct file *file, struct poll_table_struct *wai
dprintk ("%s\n", __FUNCTION__);
- if (fe->events.eventw != fe->events.eventr)
- return (POLLIN | POLLRDNORM | POLLPRI);
-
poll_wait (file, &fe->events.wait_queue, wait);
if (fe->events.eventw != fe->events.eventr)
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c
index 369542f6d..4c09c2eba 100644
--- a/linux/drivers/media/dvb/ttpci/av7110.c
+++ b/linux/drivers/media/dvb/ttpci/av7110.c
@@ -2747,24 +2747,21 @@ int av7110_ioctl(struct saa7146_dev *dev, unsigned int cmd, void *arg)
static
unsigned int dvb_audio_poll(struct file *file, poll_table *wait)
{
- struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
- av7110_t *av7110=(av7110_t *) dvbdev->priv;
- unsigned int mask=0;
+ struct dvb_device *dvbdev = (struct dvb_device *) file->private_data;
+ av7110_t *av7110 = (av7110_t *) dvbdev->priv;
+ unsigned int mask = 0;
DEB_EE(("av7110: %p\n",av7110));
if (av7110->playing) {
- if (ring_buffer_free(&av7110->aout)>20*1024)
- return (POLLOUT | POLLWRNORM);
-
poll_wait(file, &av7110->aout.queue, wait);
-
+
if (ring_buffer_free(&av7110->aout)>20*1024)
mask |= (POLLOUT | POLLWRNORM);
} else /* if not playing: may play if asked for */
- mask = (POLLOUT | POLLWRNORM);
-
- return mask;
+ mask = (POLLOUT | POLLWRNORM);
+
+ return mask;
}
@@ -3284,39 +3281,32 @@ dvb_ca_open(struct inode *inode, struct file *file)
return 0;
}
-static unsigned
-int dvb_ca_poll(struct file *file, poll_table *wait)
+static
+unsigned int dvb_ca_poll (struct file *file, poll_table *wait)
{
- struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
- av7110_t *av7110=(av7110_t *) dvbdev->priv;
-
- unsigned int mask=0;
+ struct dvb_device *dvbdev = (struct dvb_device *) file->private_data;
+ av7110_t *av7110 = (av7110_t *) dvbdev->priv;
+ unsigned int mask = 0;
- ring_buffer_t *rbuf=&av7110->ci_rbuffer;
- ring_buffer_t *wbuf=&av7110->ci_wbuffer;
+ ring_buffer_t *rbuf = &av7110->ci_rbuffer;
+ ring_buffer_t *wbuf = &av7110->ci_wbuffer;
DEB_EE(("av7110: %p\n",av7110));
- if (!ring_buffer_empty(rbuf))
- mask|=POLLIN;
- if (ring_buffer_avail(wbuf)>1024)
- mask|=POLLOUT;
- if (mask)
- return mask;
-
- poll_wait(file, &rbuf->queue, wait);
+ poll_wait (file, &rbuf->queue, wait);
if (!ring_buffer_empty(rbuf))
- mask|=POLLIN;
- if (ring_buffer_avail(wbuf)>1024)
- mask|=POLLOUT;
-
+ mask |= POLLIN;
+
+ if (ring_buffer_avail(wbuf)>1024)
+ mask |= POLLOUT;
+
return mask;
}
-static int
-dvb_ca_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, void *parg)
+static
+int dvb_ca_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, void *parg)
{
struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
av7110_t *av7110=(av7110_t *) dvbdev->priv;
@@ -3429,25 +3419,22 @@ dvb_ca_read(struct file *file, char *buf, size_t count, loff_t *ppos)
* DVB device file operations
******************************************************************************/
-static unsigned int dvb_video_poll(struct file *file, poll_table *wait)
+static
+unsigned int dvb_video_poll(struct file *file, poll_table *wait)
{
- struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
- av7110_t *av7110=(av7110_t *) dvbdev->priv;
- unsigned int mask=0;
+ struct dvb_device *dvbdev = (struct dvb_device *) file->private_data;
+ av7110_t *av7110 = (av7110_t *) dvbdev->priv;
+ unsigned int mask = 0;
DEB_EE(("av7110: %p\n",av7110));
if (av7110->playing) {
- if (FREE_COND)
- return (POLLOUT | POLLWRNORM);
-
poll_wait(file, &av7110->avout.queue, wait);
-
if (FREE_COND)
mask |= (POLLOUT | POLLWRNORM);
} else /* if not playing: may play if asked for */
mask = (POLLOUT | POLLWRNORM);
-
+
return mask;
}