[linux-dvb] [patch 2.6.12-rc4-dvb-cvs 6/14] dvb: cleanup in av7110_register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cleanup in av7110_register
- add a few local variables;
- factor out some code in av7110_dmxdev_init();
- remove a (void *) cast.

No functional change.

Signed-off-by: Francois Romieu <romieu@xxxxxxxxxxxxx>

diff -puN drivers/media/dvb/ttpci/av7110.c~dvb-170 drivers/media/dvb/ttpci/av7110.c
--- a/drivers/media/dvb/ttpci/av7110.c~dvb-170	2005-05-20 19:26:50.731593898 +0200
+++ b/drivers/media/dvb/ttpci/av7110.c	2005-05-20 19:26:50.743591920 +0200
@@ -1249,11 +1249,19 @@ static void vpeirq(unsigned long data)
 	}
 }
 
+static void av7110_dmxdev_init(struct dmxdev *dmxdev, struct dmx_demux *dmx,
+			       int filter_num, int capabilities)
+{
+	dmxdev->demux = dmx;
+	dmxdev->filternum = filter_num;
+	dmxdev->capabilities = capabilities;
+}
+
 static int av7110_register(struct av7110 *av7110)
 {
 	int ret, i;
 	struct dvb_demux *dvbdemux = &av7110->demux;
-	struct dvb_demux *dvbdemux1 = &av7110->demux1;
+	struct dmx_demux *dmx = &dvbdemux->dmx;
 
 	dprintk(4, "%p\n", av7110);
 
@@ -1275,31 +1283,28 @@ static int av7110_register(struct av7110
 	dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING |
 				      DMX_MEMORY_BASED_FILTERING);
 
-	dvb_dmx_init(&av7110->demux);
-	av7110->demux.dmx.get_stc = dvb_get_stc;
+	dvb_dmx_init(dvbdemux);
+	dmx->get_stc = dvb_get_stc;
 
-	av7110->dmxdev.filternum = 32;
-	av7110->dmxdev.demux = &dvbdemux->dmx;
-	av7110->dmxdev.capabilities = 0;
+	av7110_dmxdev_init(&av7110->dmxdev, dmx, 32, 0);
 
 	dvb_dmxdev_init(&av7110->dmxdev, &av7110->dvb_adapter);
 
 	av7110->hw_frontend.source = DMX_FRONTEND_0;
 
-	ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &av7110->hw_frontend);
+	ret = dmx->add_frontend(dmx, &av7110->hw_frontend);
 
 	if (ret < 0)
 		return ret;
 
 	av7110->mem_frontend.source = DMX_MEMORY_FE;
 
-	ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &av7110->mem_frontend);
+	ret = dmx->add_frontend(dmx, &av7110->mem_frontend);
 
 	if (ret < 0)
 		return ret;
 
-	ret = dvbdemux->dmx.connect_frontend(&dvbdemux->dmx,
-					     &av7110->hw_frontend);
+	ret = dmx->connect_frontend(dmx, &av7110->hw_frontend);
 	if (ret < 0)
 		return ret;
 
@@ -1311,13 +1316,16 @@ static int av7110_register(struct av7110
 			    &dvbdev_osd, av7110, DVB_DEVICE_OSD);
 #endif
 
-	dvb_net_init(&av7110->dvb_adapter, &av7110->dvb_net, &dvbdemux->dmx);
+	dvb_net_init(&av7110->dvb_adapter, &av7110->dvb_net, dmx);
 
 	if (budgetpatch) {
+		struct dvb_demux *dvbdemux1 = &av7110->demux1;
+		struct dmx_demux *dmx1 = &dvbdemux1->dmx;
+
 		/* initialize software demux1 without its own frontend
 		 * demux1 hardware is connected to frontend0 of demux0
 		 */
-		dvbdemux1->priv = (void *) av7110;
+		dvbdemux1->priv = av7110;
 
 		dvbdemux1->filternum = 256;
 		dvbdemux1->feednum = 256;
@@ -1325,18 +1333,16 @@ static int av7110_register(struct av7110
 		dvbdemux1->stop_feed = budget_stop_feed;
 		dvbdemux1->write_to_decoder = NULL;
 
-		dvbdemux1->dmx.capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING |
-					       DMX_MEMORY_BASED_FILTERING);
+		dmx1->capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING |
+				      DMX_MEMORY_BASED_FILTERING);
 
 		dvb_dmx_init(&av7110->demux1);
 
-		av7110->dmxdev1.filternum = 256;
-		av7110->dmxdev1.demux = &dvbdemux1->dmx;
-		av7110->dmxdev1.capabilities = 0;
+		av7110_dmxdev_init(&av7110->dmxdev1, dmx1, 256, 0);
 
 		dvb_dmxdev_init(&av7110->dmxdev1, &av7110->dvb_adapter);
 
-		dvb_net_init(&av7110->dvb_adapter, &av7110->dvb_net1, &dvbdemux1->dmx);
+		dvb_net_init(&av7110->dvb_adapter, &av7110->dvb_net1, dmx1);
 		printk("dvb-ttpci: additional demux1 for budget-patch registered\n");
 	}
 	return 0;

_



[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux