Mailing List archive

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

[linux-dvb] Re: [PATCH] dvb-ttpci+budgetpatch integrated late patch 08



HI Johannes

My last budgetpatch-patch is not for the 
current dvb-kernel release, discard. 

This is my new patch after your separate patch
for bautification

Like before, I corrected few flaws of myself, 
moved vpeirq to be present only in budgetpatch 
mode and added stopping of the tasklets etc, all 
this to fix stability for insmod/rmmod 

The beautification fix brought up (again) dvb_net 
issue, the dvb_net string "dvb" I think has to be
of the right length when we overwrite it
with dvb0_0. Otherwise removing of the network
interfaces sometimes wants to hang.

Emard
diff -pur dvb-kernel.orig/linux/drivers/media/dvb/dvb-core/dvb_net.c dvb-kernel/linux/drivers/media/dvb/dvb-core/dvb_net.c
--- dvb-kernel.orig/linux/drivers/media/dvb/dvb-core/dvb_net.c	2005-01-08 23:47:17.000000000 +0100
+++ dvb-kernel/linux/drivers/media/dvb/dvb-core/dvb_net.c	2005-01-09 01:06:27.000000000 +0100
@@ -1161,8 +1161,8 @@ static int dvb_net_add_if(struct dvb_net
 		return -EINVAL;
 	if ((if_num = get_if(dvbnet)) < 0)
 		return -EINVAL;
-
-	net = alloc_netdev(sizeof(struct dvb_net_priv), "dvb", dvb_net_setup);
+	/* "dvb0_0" string must in advance be of the right length */
+	net = alloc_netdev(sizeof(struct dvb_net_priv), "dvb0_0", dvb_net_setup);
 	if (!net)
 		return -ENOMEM;
 
Only in dvb-kernel/linux/drivers/media/dvb/dvb-core: dvb_net.c~
diff -pur dvb-kernel.orig/linux/drivers/media/dvb/ttpci/av7110.c dvb-kernel/linux/drivers/media/dvb/ttpci/av7110.c
--- dvb-kernel.orig/linux/drivers/media/dvb/ttpci/av7110.c	2005-01-08 23:47:20.000000000 +0100
+++ dvb-kernel/linux/drivers/media/dvb/ttpci/av7110.c	2005-01-09 00:32:57.000000000 +0100
@@ -1151,15 +1151,14 @@ static int stop_ts_capture(struct av7110
 
 	if (--budget->feeding1)
 		return budget->feeding1;
-	saa7146_write(budget->dev, MC1, MASK_20);	// DMA3 off
+	saa7146_write(budget->dev, MC1, MASK_20);	/* DMA3 off */
 	SAA7146_IER_DISABLE(budget->dev, MASK_10);
+	SAA7146_ISR_CLEAR(budget->dev, MASK_10);
 	return 0;
 }
 
 static int start_ts_capture(struct av7110 *budget)
 {
-	struct saa7146_dev *dev = budget->dev;
-
 	dprintk(2, "budget: %p\n", budget);
 
 	if (budget->feeding1)
@@ -1167,8 +1166,8 @@ static int start_ts_capture(struct av711
 	memset(budget->grabbing, 0x00, TS_HEIGHT * TS_WIDTH);
 	budget->tsf = 0xff;
 	budget->ttbp = 0;
-	saa7146_write(dev, MC1, (MASK_04 | MASK_20));	// DMA3 on
-	SAA7146_IER_ENABLE(budget->dev, MASK_10);	// VPE
+	SAA7146_IER_ENABLE(budget->dev, MASK_10); /* VPE */
+	saa7146_write(budget->dev, MC1, (MASK_04 | MASK_20)); /* DMA3 on */
 	return ++budget->feeding1;
 }
 
@@ -2291,7 +2290,7 @@ err_no_mem:
 					 dev->pci, length, &av7110->pt);
 		if (!av7110->grabbing)
 			goto err_no_mem;
-		saa7146_write(dev, PCI_BT_V1, 0x1c1c101f);
+		saa7146_write(dev, PCI_BT_V1, 0x1c1f101f);
 		saa7146_write(dev, BCS_CTRL, 0x80400040);
 		/* set dd1 stream a & b */
 		saa7146_write(dev, DD1_STREAM_B, 0x00000000);
@@ -2363,6 +2362,7 @@ err_no_mem:
 		saa7146_write(dev, MC1, (MASK_13 | MASK_29));
 
 		/* end of budgetpatch register initialization */
+		tasklet_init (&av7110->vpe_tasklet,  vpeirq,  (unsigned long) av7110);
 	} else {
 		saa7146_write(dev, PCI_BT_V1, 0x1c00101f);
 		saa7146_write(dev, BCS_CTRL, 0x80400040);
@@ -2377,7 +2377,6 @@ err_no_mem:
 		saa7146_write(dev, GPIO_CTRL, 0x000000);
 	}
 
-	tasklet_init (&av7110->vpe_tasklet,  vpeirq,  (unsigned long) av7110);
 	tasklet_init (&av7110->debi_tasklet, debiirq, (unsigned long) av7110);
 	tasklet_init (&av7110->gpio_tasklet, gpioirq, (unsigned long) av7110);
 
@@ -2491,10 +2490,15 @@ static int av7110_detach(struct saa7146_
 	if (!av7110->device_initialized )
 		return 0;
 
-	tasklet_kill(&av7110->vpe_tasklet);
 	if (budgetpatch)
+	{
+		saa7146_write(saa, MC1, MASK_20);	/* DMA3 off */
+		SAA7146_IER_DISABLE(saa, MASK_10);
+		SAA7146_ISR_CLEAR(saa, MASK_10);
+		msleep(50);
+		tasklet_kill(&av7110->vpe_tasklet);
 		saa7146_pgtable_free(saa->pci, &av7110->pt);
-
+	}
 	av7110_exit_v4l(av7110);
 
 	av7110->arm_rmmod = 1;
@@ -2503,6 +2507,9 @@ static int av7110_detach(struct saa7146_
 	while (av7110->arm_thread)
 		msleep(1);
 
+	tasklet_kill(&av7110->debi_tasklet);
+	tasklet_kill(&av7110->gpio_tasklet);
+
 	dvb_unregister(av7110);
 
 	SAA7146_IER_DISABLE(saa, MASK_19 | MASK_03);
@@ -2569,7 +2576,8 @@ static void av7110_irq(struct saa7146_de
 	}
 
 	if (*isr & MASK_10)
-		tasklet_schedule(&av7110->vpe_tasklet);
+		if (budgetpatch)
+			tasklet_schedule(&av7110->vpe_tasklet);
 }
 
 
Only in dvb-kernel/linux/drivers/media/dvb/ttpci: av7110.c~

Home | Main Index | Thread Index