[linux-dvb] [PATCH] dmxdev.c some possible cleanups

Peter Beutner p.beutner at gmx.net
Tue Jun 21 15:36:07 CEST 2005


Hi
the patch removes the following things:

- remove void casts

- not necessary to set filter state twice to STATE_FREE during 
dvb_dmxdev_init()

- in the following code:
     if (!dmxdevfilter->feed.sec)
          break;
      dvb_dmxdev_feed_stop(dmxdevfilter);
     if (dmxdevfilter->filter.sec)
   The second check is senseless as it is only reached if 
dmxdevfilter->filter.sec is not NULL.

Signed-off-by: Peter Beutner <p.beutner at gmx.net>
-------------- next part --------------
Index: linux/drivers/media/dvb/dvb-core/dmxdev.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/dvb-core/dmxdev.c,v
retrieving revision 1.41
diff -p -u -r1.41 dmxdev.c
--- linux/drivers/media/dvb/dvb-core/dmxdev.c	12 Jun 2005 12:27:13 -0000	1.41
+++ linux/drivers/media/dvb/dvb-core/dmxdev.c	21 Jun 2005 12:56:47 -0000
@@ -42,12 +42,6 @@ MODULE_PARM_DESC(debug, "Turn on/off deb
 
 #define dprintk	if (debug) printk
 
-static inline struct dmxdev_filter *
-dvb_dmxdev_file_to_filter(struct file *file)
-{
-	return (struct dmxdev_filter *) file->private_data;
-}
-
 static inline void dvb_dmxdev_buffer_init(struct dmxdev_buffer *buffer)
 {
 	buffer->data=NULL;
@@ -487,10 +481,8 @@ static int dvb_dmxdev_filter_stop(struct
 		if (!dmxdevfilter->feed.sec)
 			break;
 		dvb_dmxdev_feed_stop(dmxdevfilter);
-		if (dmxdevfilter->filter.sec)
-			dmxdevfilter->feed.sec->
-				release_filter(dmxdevfilter->feed.sec,
-					       dmxdevfilter->filter.sec);
+		dmxdevfilter->feed.sec->release_filter(dmxdevfilter->feed.sec,
+							dmxdevfilter->filter.sec);
 		dvb_dmxdev_feed_restart(dmxdevfilter);
 		dmxdevfilter->feed.sec=NULL;
 		break;
@@ -844,7 +836,7 @@ static ssize_t dvb_dmxdev_read_sec(struc
 static ssize_t
 dvb_demux_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 {
-	struct dmxdev_filter *dmxdevfilter=dvb_dmxdev_file_to_filter(file);
+	struct dmxdev_filter *dmxdevfilter= file->private_data;
 	int ret=0;
 
 	if (down_interruptible(&dmxdevfilter->mutex))
@@ -865,7 +857,7 @@ dvb_demux_read(struct file *file, char _
 static int dvb_demux_do_ioctl(struct inode *inode, struct file *file,
 			      unsigned int cmd, void *parg)
 {
-	struct dmxdev_filter *dmxdevfilter=dvb_dmxdev_file_to_filter(file);
+	struct dmxdev_filter *dmxdevfilter = file->private_data;
 	struct dmxdev *dmxdev=dmxdevfilter->dev;
 	unsigned long arg=(unsigned long) parg;
 	int ret=0;
@@ -962,7 +954,7 @@ static int dvb_demux_ioctl(struct inode 
 
 static unsigned int dvb_demux_poll (struct file *file, poll_table *wait)
 {
-	struct dmxdev_filter *dmxdevfilter = dvb_dmxdev_file_to_filter(file);
+	struct dmxdev_filter *dmxdevfilter = file->private_data;
 	unsigned int mask = 0;
 
 	if (!dmxdevfilter)
@@ -987,7 +979,7 @@ static unsigned int dvb_demux_poll (stru
 
 static int dvb_demux_release(struct inode *inode, struct file *file)
 {
-	struct dmxdev_filter *dmxdevfilter = dvb_dmxdev_file_to_filter(file);
+	struct dmxdev_filter *dmxdevfilter = file->private_data;
 	struct dmxdev *dmxdev = dmxdevfilter->dev;
 
 	return dvb_dmxdev_filter_free(dmxdev, dmxdevfilter);
@@ -1111,7 +1103,6 @@ dvb_dmxdev_init(struct dmxdev *dmxdev, s
 		dvb_dmxdev_filter_state_set(&dmxdev->filter[i], DMXDEV_STATE_FREE);
 		dmxdev->dvr[i].dev=dmxdev;
 		dmxdev->dvr[i].buffer.data=NULL;
-		dvb_dmxdev_filter_state_set(&dmxdev->filter[i], DMXDEV_STATE_FREE);
 		dvb_dmxdev_dvr_state_set(&dmxdev->dvr[i], DMXDEV_STATE_FREE);
 	}
 


More information about the linux-dvb mailing list