[linux-dvb] [patch 2.6.12-rc4-dvb-cvs 8/14] dvb: split av7110_register

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

 



Split av7110_register

Beside arguable aesthetical or clarity reason, this change helps
to do sane error checking. Currently the error checking is almost
non-existent.

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

diff -puN drivers/media/dvb/ttpci/av7110.c~dvb-190 drivers/media/dvb/ttpci/av7110.c
--- a/drivers/media/dvb/ttpci/av7110.c~dvb-190	2005-05-20 19:30:33.184039604 +0200
+++ b/drivers/media/dvb/ttpci/av7110.c	2005-05-20 19:30:33.213034851 +0200
@@ -1257,6 +1257,41 @@ static void av7110_dmxdev_init(struct dm
 	dmxdev->capabilities = capabilities;
 }
 
+static int __av7110_budget_register(struct av7110 *av7110)
+{
+	struct dvb_demux *dvbdemux = &av7110->demux1;
+	struct dmxdev *dmxdev = &av7110->dmxdev1;
+	struct dmx_demux *dmx = &dvbdemux->dmx;
+
+	if (!budgetpatch)
+		goto out;
+	/*
+	 * Initialize software demux1 without its own frontend
+	 * demux1 hardware is connected to frontend0 of demux0
+	 */
+	dvbdemux->priv = av7110;
+
+	dvbdemux->filternum = 256;
+	dvbdemux->feednum = 256;
+	dvbdemux->start_feed = budget_start_feed;
+	dvbdemux->stop_feed = budget_stop_feed;
+	dvbdemux->write_to_decoder = NULL;
+
+	dmx->capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING |
+			      DMX_MEMORY_BASED_FILTERING);
+
+	dvb_dmx_init(dvbdemux);
+
+	av7110_dmxdev_init(dmxdev, dmx, 256, 0);
+
+	dvb_dmxdev_init(dmxdev, &av7110->dvb_adapter);
+
+	dvb_net_init(&av7110->dvb_adapter, &av7110->dvb_net1, dmx);
+	printk("dvb-ttpci: additional demux1 for budget-patch registered\n");
+out:
+	return 0;
+}
+
 static int av7110_register(struct av7110 *av7110)
 {
 	int ret, i;
@@ -1318,34 +1353,9 @@ static int av7110_register(struct av7110
 
 	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 = av7110;
-
-		dvbdemux1->filternum = 256;
-		dvbdemux1->feednum = 256;
-		dvbdemux1->start_feed = budget_start_feed;
-		dvbdemux1->stop_feed = budget_stop_feed;
-		dvbdemux1->write_to_decoder = NULL;
-
-		dmx1->capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING |
-				      DMX_MEMORY_BASED_FILTERING);
-
-		dvb_dmx_init(&av7110->demux1);
-
-		av7110_dmxdev_init(&av7110->dmxdev1, dmx1, 256, 0);
-
-		dvb_dmxdev_init(&av7110->dmxdev1, &av7110->dvb_adapter);
+	ret = __av7110_budget_register(av7110);
 
-		dvb_net_init(&av7110->dvb_adapter, &av7110->dvb_net1, dmx1);
-		printk("dvb-ttpci: additional demux1 for budget-patch registered\n");
-	}
-	return 0;
+	return ret;
 }
 
 

_



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

  Powered by Linux