[linux-dvb] [PATCH] misc demux cleanups

Andreas Oberritter obi at linuxtv.org
Thu Mar 17 05:57:57 CET 2005


Hi,

I'd like to apply this patch, which basically removes unused variables
from some structs. However, I am not sure whether there are drivers
outside the linuxtv tree using them. If so, then please tell me which
parts shall not be removed.

Regards,
Andreas

Index: linux/drivers/media/dvb/dvb-core/demux.h
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/dvb-core/demux.h,v
retrieving revision 1.14
diff -u -r1.14 demux.h
--- linux/drivers/media/dvb/dvb-core/demux.h	2 Mar 2005 21:42:00 -0000	1.14
+++ linux/drivers/media/dvb/dvb-core/demux.h	17 Mar 2005 04:43:10 -0000
@@ -124,9 +124,7 @@
 		    u16 pid,
 		    int type,
 		    enum dmx_ts_pes pes_type,
-		    size_t callback_length,
 		    size_t circular_buffer_size,
-		    int descramble,
 		    struct timespec timeout);
         int (*start_filtering) (struct dmx_ts_feed* feed);
         int (*stop_filtering) (struct dmx_ts_feed* feed);
@@ -147,7 +145,6 @@
 struct dmx_section_feed {
         int is_filtering; /* Set to non-zero when filtering in progress */
         struct dmx_demux* parent; /* Back-pointer */
-        void* priv; /* Pointer to private data of the API client */
 
         int check_crc;
 	u32 crc_val;
@@ -159,7 +156,6 @@
         int (*set) (struct dmx_section_feed* feed,
 		    u16 pid,
 		    size_t circular_buffer_size,
-		    int descramble,
 		    int check_crc);
         int (*allocate_filter) (struct dmx_section_feed* feed,
 				struct dmx_section_filter** filter);
@@ -207,7 +203,6 @@
         struct list_head connectivity_list; /* List of front-ends that can
 					       be connected to a particular
 					       demux */
-        void* priv;     /* Pointer to private data of the API client */
         enum dmx_frontend_source source;
 };
 
@@ -225,8 +220,6 @@
 #define DMX_MEMORY_BASED_FILTERING              8    /* write() available */
 #define DMX_CRC_CHECKING                        16
 #define DMX_TS_DESCRAMBLING                     32
-#define DMX_SECTION_PAYLOAD_DESCRAMBLING        64
-#define DMX_MAC_ADDRESS_DESCRAMBLING            128
 
 /*
  * Demux resource type identifier.
@@ -244,9 +237,7 @@
 struct dmx_demux {
         u32 capabilities;            /* Bitfield of capability flags */
         struct dmx_frontend* frontend;    /* Front-end connected to the demux */
-        struct list_head reg_list;   /* List of registered demuxes */
         void* priv;                  /* Pointer to private data of the API client */
-        int users;                   /* Number of users */
         int (*open) (struct dmx_demux* demux);
         int (*close) (struct dmx_demux* demux);
         int (*write) (struct dmx_demux* demux, const char* buf, size_t count);
@@ -260,17 +251,6 @@
 				      dmx_section_cb callback);
         int (*release_section_feed) (struct dmx_demux* demux,
 				     struct dmx_section_feed* feed);
-        int (*descramble_mac_address) (struct dmx_demux* demux,
-				       u8* buffer1,
-				       size_t buffer1_length,
-				       u8* buffer2,
-				       size_t buffer2_length,
-				       u16 pid);
-        int (*descramble_section_payload) (struct dmx_demux* demux,
-					   u8* buffer1,
-					   size_t buffer1_length,
-					   u8* buffer2, size_t buffer2_length,
-					   u16 pid);
         int (*add_frontend) (struct dmx_demux* demux,
 			     struct dmx_frontend* frontend);
         int (*remove_frontend) (struct dmx_demux* demux,
@@ -286,16 +266,4 @@
 			u64 *stc, unsigned int *base);
 };
 
-/*--------------------------------------------------------------------------*/
-/* Demux directory */
-/*--------------------------------------------------------------------------*/
-
-/*
- * DMX_DIR_ENTRY(): Casts elements in the list of registered
- * demuxes from the generic type struct list_head* to the type struct dmx_demux
- *.
- */
-
-#define DMX_DIR_ENTRY(list) list_entry(list, struct dmx_demux, reg_list)
-
 #endif /* #ifndef __DEMUX_H */
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.39
diff -u -r1.39 dmxdev.c
--- linux/drivers/media/dvb/dvb-core/dmxdev.c	13 Mar 2005 23:30:36 -0000	1.39
+++ linux/drivers/media/dvb/dvb-core/dmxdev.c	17 Mar 2005 04:43:10 -0000
@@ -577,7 +577,7 @@
 				return ret;
 			}
 
-			ret=(*secfeed)->set(*secfeed, para->pid, 32768, 0,
+			ret=(*secfeed)->set(*secfeed, para->pid, 32768,
 					    (para->flags & DMX_CHECK_CRC) ? 1 : 0);
 
 			if (ret<0) {
@@ -660,7 +660,7 @@
 		(*tsfeed)->priv = (void *) filter;
 
 		ret = (*tsfeed)->set(*tsfeed, para->pid, ts_type, ts_pes,
-				     188, 32768, 0, timeout);
+				     32768, timeout);
 
 		if (ret < 0) {
 			dmxdev->demux->release_ts_feed(dmxdev->demux, *tsfeed);
Index: linux/drivers/media/dvb/dvb-core/dvb_demux.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/dvb-core/dvb_demux.c,v
retrieving revision 1.63
diff -u -r1.63 dvb_demux.c
--- linux/drivers/media/dvb/dvb-core/dvb_demux.c	2 Mar 2005 21:42:00 -0000	1.63
+++ linux/drivers/media/dvb/dvb-core/dvb_demux.c	17 Mar 2005 04:43:10 -0000
@@ -39,33 +39,6 @@
 // #define DVB_DEMUX_SECTION_LOSS_LOG
 
 
-static LIST_HEAD(dmx_muxs);
-
-
-static int dmx_register_demux(struct dmx_demux *demux)
-{
-	demux->users = 0;
-	list_add(&demux->reg_list, &dmx_muxs);
-	return 0;
-}
-
-static int dmx_unregister_demux(struct dmx_demux* demux)
-{
-	struct list_head *pos, *n, *head=&dmx_muxs;
-
-	list_for_each_safe (pos, n, head) {
-		if (DMX_DIR_ENTRY(pos) == demux) {
-			if (demux->users>0)
-				return -EINVAL;
-			list_del(pos);
-			return 0;
-		}
-	}
-
-	return -ENODEV;
-}
-
-
 /******************************************************************************
  * static inlined helper functions
  ******************************************************************************/
@@ -605,8 +578,8 @@
 }
 
 static int dmx_ts_feed_set (struct dmx_ts_feed* ts_feed, u16 pid, int ts_type,
-		     enum dmx_ts_pes pes_type, size_t callback_length,
-		     size_t circular_buffer_size, int descramble,
+		     enum dmx_ts_pes pes_type,
+		     size_t circular_buffer_size,
 		     struct timespec timeout)
 {
 	struct dvb_demux_feed *feed = (struct dvb_demux_feed *) ts_feed;
@@ -638,17 +611,10 @@
 
 	feed->pid = pid;
 	feed->buffer_size = circular_buffer_size;
-	feed->descramble = descramble;
 	feed->timeout = timeout;
-	feed->cb_length = callback_length;
 	feed->ts_type = ts_type;
 	feed->pes_type = pes_type;
 
-	if (feed->descramble) {
-		up(&demux->mutex);
-		return -ENOSYS;
-	}
-
 	if (feed->buffer_size) {
 #ifdef NOBUFS
 		feed->buffer=NULL;
@@ -847,7 +813,7 @@
 
 static int dmx_section_feed_set(struct dmx_section_feed* feed,
 			 u16 pid, size_t circular_buffer_size,
-			 int descramble, int check_crc)
+			 int check_crc)
 {
 	struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *) feed;
 	struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
@@ -862,12 +828,6 @@
 
 	dvbdmxfeed->pid = pid;
 	dvbdmxfeed->buffer_size = circular_buffer_size;
-	dvbdmxfeed->descramble = descramble;
-	if (dvbdmxfeed->descramble) {
-		up(&dvbdmx->mutex);
-		return -ENOSYS;
-	}
-
 	dvbdmxfeed->feed.sec.check_crc = check_crc;
 
 #ifdef NOBUFS
@@ -1044,7 +1004,6 @@
 	(*feed)=&dvbdmxfeed->feed.sec;
 	(*feed)->is_filtering = 0;
 	(*feed)->parent = demux;
-	(*feed)->priv = NULL;
 
 	(*feed)->set = dmx_section_feed_set;
 	(*feed)->allocate_filter = dmx_section_feed_allocate_filter;
@@ -1136,7 +1095,7 @@
 	struct dvb_demux *dvbdemux = (struct dvb_demux *) demux;
 	struct list_head *head = &dvbdemux->frontend_list;
 
-	list_add(&(frontend->connectivity_list), head);
+	list_add(&frontend->connectivity_list, head);
 
 	return 0;
 }
@@ -1208,7 +1167,7 @@
 
 int dvb_dmx_init(struct dvb_demux *dvbdemux)
 {
-	int i, err;
+	int i;
 	struct dmx_demux *dmx = &dvbdemux->dmx;
 
 	dvbdemux->users = 0;
@@ -1230,9 +1189,9 @@
 		dvbdemux->feed[i].state = DMX_STATE_FREE;
 		dvbdemux->feed[i].index = i;
 	}
-	dvbdemux->frontend_list.next=
-	  dvbdemux->frontend_list.prev=
-	    &dvbdemux->frontend_list;
+
+	INIT_LIST_HEAD(&dvbdemux->frontend_list);
+
 	for (i=0; i<DMX_TS_PES_OTHER; i++) {
 		dvbdemux->pesfilter[i] = NULL;
 		dvbdemux->pids[i] = 0xffff;
@@ -1240,8 +1199,6 @@
 
 	INIT_LIST_HEAD(&dvbdemux->feed_list);
 
-	dvbdemux->playing = 0;
-	dvbdemux->recording = 0;
 	dvbdemux->tsbufp = 0;
 
 	if (!dvbdemux->check_crc32)
@@ -1251,8 +1208,7 @@
 		 dvbdemux->memcopy = dvb_dmx_memcopy;
 
 	dmx->frontend = NULL;
-	dmx->reg_list.prev = dmx->reg_list.next = &dmx->reg_list;
-	dmx->priv = (void *) dvbdemux;
+	dmx->priv = dvbdemux;
 	dmx->open = dvbdmx_open;
 	dmx->close = dvbdmx_close;
 	dmx->write = dvbdmx_write;
@@ -1261,9 +1217,6 @@
 	dmx->allocate_section_feed = dvbdmx_allocate_section_feed;
 	dmx->release_section_feed = dvbdmx_release_section_feed;
 
-	dmx->descramble_mac_address = NULL;
-	dmx->descramble_section_payload = NULL;
-
 	dmx->add_frontend = dvbdmx_add_frontend;
 	dmx->remove_frontend = dvbdmx_remove_frontend;
 	dmx->get_frontends = dvbdmx_get_frontends;
@@ -1274,21 +1227,14 @@
 	sema_init(&dvbdemux->mutex, 1);
 	spin_lock_init(&dvbdemux->lock);
 
-	if ((err = dmx_register_demux(dmx)) < 0)
-		return err;
-
 	return 0;
 }
 EXPORT_SYMBOL(dvb_dmx_init);
 
 
-int dvb_dmx_release(struct dvb_demux *dvbdemux)
+void dvb_dmx_release(struct dvb_demux *dvbdemux)
 {
-	struct dmx_demux *dmx = &dvbdemux->dmx;
-
-	dmx_unregister_demux(dmx);
 	vfree(dvbdemux->filter);
 	vfree(dvbdemux->feed);
-	return 0;
 }
 EXPORT_SYMBOL(dvb_dmx_release);
Index: linux/drivers/media/dvb/dvb-core/dvb_demux.h
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/dvb-core/dvb_demux.h,v
retrieving revision 1.24
diff -u -r1.24 dvb_demux.h
--- linux/drivers/media/dvb/dvb-core/dvb_demux.h	2 Mar 2005 21:42:00 -0000	1.24
+++ linux/drivers/media/dvb/dvb-core/dvb_demux.h	17 Mar 2005 04:43:10 -0000
@@ -54,12 +54,8 @@
         int index;
         int state;
         int type;
-	int pesto;
 
-        u16 handle;
-        u16 hw_handle;
         struct timer_list timer;
-	int ts_state;
 };
 
 
@@ -87,7 +83,6 @@
 
         struct timespec timeout;
         struct dvb_demux_filter *filter;
-        int cb_length;
 
         int ts_type;
         enum dmx_ts_pes pes_type;
@@ -98,7 +93,8 @@
         u16 peslen;
 
 	struct list_head list_head;
-		int index; /* a unique index for each feed (can be used as hardware pid filter index) */
+
+	unsigned int index; /* a unique index for each feed (can be used as hardware pid filter index) */
 };
 
 struct dvb_demux {
@@ -124,8 +120,6 @@
 
         struct dvb_demux_feed *pesfilter[DMX_TS_PES_OTHER];
         u16 pids[DMX_TS_PES_OTHER];
-        int playing;
-        int recording;
 
 #define DMX_MAX_PID 0x2000
 	struct list_head feed_list;
@@ -138,7 +132,7 @@
 
 
 int dvb_dmx_init(struct dvb_demux *dvbdemux);
-int dvb_dmx_release(struct dvb_demux *dvbdemux);
+void dvb_dmx_release(struct dvb_demux *dvbdemux);
 void dvb_dmx_swfilter_packets(struct dvb_demux *dvbdmx, const u8 *buf, size_t count);
 void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count);
 void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count);
Index: linux/drivers/media/dvb/dvb-core/dvb_net.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/dvb-core/dvb_net.c,v
retrieving revision 1.57
diff -u -r1.57 dvb_net.c
--- linux/drivers/media/dvb/dvb-core/dvb_net.c	12 Feb 2005 01:24:28 -0000	1.57
+++ linux/drivers/media/dvb/dvb-core/dvb_net.c	17 Mar 2005 04:43:10 -0000
@@ -891,7 +891,7 @@
 			return ret;
 		}
 
-		ret = priv->secfeed->set(priv->secfeed, priv->pid, 32768, 0, 1);
+		ret = priv->secfeed->set(priv->secfeed, priv->pid, 32768, 1);
 
 		if (ret<0) {
 			printk("%s: could not set section feed\n", dev->name);
@@ -943,9 +943,7 @@
 		priv->tsfeed->priv = (void *)dev;
 		ret = priv->tsfeed->set(priv->tsfeed, priv->pid,
 					TS_PACKET, DMX_TS_PES_OTHER,
-					188 * 100, /* nr. of bytes delivered per callback */
 					32768,     /* circular buffer size */
-					0,         /* descramble */
 					timeout);
 
 		if (ret < 0) {
Index: linux/drivers/media/dvb/ttpci/av7110.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/ttpci/av7110.c,v
retrieving revision 1.178
diff -u -r1.178 av7110.c
--- linux/drivers/media/dvb/ttpci/av7110.c	17 Mar 2005 03:16:11 -0000	1.178
+++ linux/drivers/media/dvb/ttpci/av7110.c	17 Mar 2005 04:43:11 -0000
@@ -416,7 +416,7 @@
 		break;
 
 	case DATA_PES_RECORD:
-		if (av7110->demux.recording)
+		if (av7110->rec_mode)
 			av7110_record_cb(&av7110->p2t[handle],
 					 (u8 *) av7110->debi_virt,
 					 av7110->debilen);
@@ -835,12 +835,12 @@
 				"ret %x  handle %04x\n",
 				__FUNCTION__, buf[0], buf[1], buf[2], buf[3],
 				ret, handle);
-		dvbdmxfilter->hw_handle = 0xffff;
+		av7110->handle[dvbdmxfilter->index] = 0xffff;
 		return -1;
 	}
 
 	av7110->handle2filter[handle] = dvbdmxfilter;
-	dvbdmxfilter->hw_handle = handle;
+	av7110->handle[dvbdmxfilter->index] = handle;
 
 	return ret;
 }
@@ -855,7 +855,7 @@
 
 	dprintk(4, "%p\n", av7110);
 
-	handle = dvbdmxfilter->hw_handle;
+	handle = av7110->handle[dvbdmxfilter->index];
 	if (handle >= 32) {
 		printk("%s tried to stop invalid filter %04x, filter type = %x\n",
 				__FUNCTION__, handle, dvbdmxfilter->type);
@@ -921,13 +921,9 @@
 
 	dprintk(4, "%p\n", av7110);
 
-	if (dvbdmxfeed->pes_type <= 1) {
+	if (dvbdmxfeed->pes_type <= 1)
 		av7110_av_stop(av7110, dvbdmxfeed->pes_type ?  RP_VIDEO : RP_AUDIO);
-		if (!av7110->rec_mode)
-			dvbdmx->recording = 0;
-		if (!av7110->playing)
-			dvbdmx->playing = 0;
-	}
+
 	npids[0] = npids[1] = npids[2] = npids[3] = npids[4] = 0xffff;
 	i = dvbdmxfeed->pes_type;
 	switch (i) {
@@ -972,7 +968,6 @@
 					       dvb_ringbuffer_flush_spinlock_wakeup(&av7110->avout);
 					       dvb_ringbuffer_flush_spinlock_wakeup(&av7110->aout);
 					       av7110_av_start_play(av7110,RP_AV);
-					       demux->playing = 1;
 					}
 				break;
 			default:
Index: linux/drivers/media/dvb/ttpci/av7110.h
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/ttpci/av7110.h,v
retrieving revision 1.40
diff -u -r1.40 av7110.h
--- linux/drivers/media/dvb/ttpci/av7110.h	17 Mar 2005 03:16:11 -0000	1.40
+++ linux/drivers/media/dvb/ttpci/av7110.h	17 Mar 2005 04:43:11 -0000
@@ -185,6 +185,7 @@
 	struct audio_status	audiostate;
 
 	struct dvb_demux_filter *handle2filter[32];
+	u16			handle[MAXFILT];
 	struct av7110_p2t	 p2t_filter[MAXFILT];
 	struct dvb_filter_pes2ts p2t[2];
 	struct ipack		 ipack[2];
Index: linux/drivers/media/dvb/ttpci/av7110_av.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/ttpci/av7110_av.c,v
retrieving revision 1.15
diff -u -r1.15 av7110_av.c
--- linux/drivers/media/dvb/ttpci/av7110_av.c	17 Mar 2005 03:16:11 -0000	1.15
+++ linux/drivers/media/dvb/ttpci/av7110_av.c	17 Mar 2005 04:43:11 -0000
@@ -128,7 +128,6 @@
 	if (av7110->playing || (av7110->rec_mode & av))
 		return -EBUSY;
 	av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Stop, 0);
-	dvbdmx->recording = 1;
 	av7110->rec_mode |= av;
 
 	switch (av7110->rec_mode) {






More information about the linux-dvb mailing list