[Asterisk-cvs] zaptel wct4xxp.c,1.41,1.42

markster at lists.digium.com markster at lists.digium.com
Sat Apr 24 14:54:03 CDT 2004


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv5487

Modified Files:
	wct4xxp.c 
Log Message:
Don't double lock reglock


Index: wct4xxp.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wct4xxp.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- wct4xxp.c	23 Apr 2004 02:10:18 -0000	1.41
+++ wct4xxp.c	24 Apr 2004 18:59:30 -0000	1.42
@@ -392,8 +392,8 @@
 	struct t4 *wc = chan->pvt;
 	unsigned long flags;
 	
-	spin_lock_irqsave(&wc->reglock, flags);	
 	if(debug) printk("Setting bits to %d on channel %s\n", bits, chan->name);
+	spin_lock_irqsave(&wc->reglock, flags);	
 	k = chan->span->offset;
 	if (wc->spantype[k] == TYPE_E1) { /* do it E1 way */
 		if (chan->chanpos == 16) {
@@ -432,9 +432,9 @@
 		  /* output them to the chip */
 		__t4_framer_out(wc,k,0x70 + b,c); 
 	} 
+	spin_unlock_irqrestore(&wc->reglock, flags);
 	if (debug)
 		printk("Finished setting RBS bits\n");
-	spin_unlock_irqrestore(&wc->reglock, flags);
 	return 0;
 }
 
@@ -487,10 +487,13 @@
 	span->lineconfig = lc->lineconfig;
 	span->txlevel = lc->lbo;
 	span->rxlevel = 0;
-	span->syncsrc = wc->syncsrc;
+	if (lc->sync < 0)
+		lc->sync = 0;
+	if (lc->sync > 4)
+		lc->sync = 0;
 	
 	/* remove this span number from the current sync sources, if there */
-	for(i = 0; i < 3; i++) {
+	for(i = 0; i < 4; i++) {
 		if (wc->syncs[i] == span->spanno) {
 			wc->syncs[i] = 0;
 			wc->psyncs[i] = 0;
@@ -502,6 +505,7 @@
 		wc->syncs[lc->sync - 1] = span->spanno;
 		wc->psyncs[lc->sync - 1] = span->offset + 1;
 	}
+	wc->checktiming = 1;
 	/* If we're already running, then go ahead and apply the changes */
 	if (span->flags & ZT_FLAG_RUNNING)
 		return t4_startup(span);
@@ -637,12 +641,12 @@
 	if ((unit > -1) && (unit < 4)) {
 		timing |= (unit << 6);
 		for (x=0;x<4;x++)  /* set all 4 receive reference clocks to unit */
-			t4_framer_out(wc, x, 0x44, timing);
-		t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29));
+			__t4_framer_out(wc, x, 0x44, timing);
+		__t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29));
 	} else {
 		for (x=0;x<4;x++) /* set each receive reference clock to itself */
-			t4_framer_out(wc, x, 0x44, timing | (x << 6));
-		t4_pci_out(wc, WC_DMACTRL, wc->dmactrl);
+			__t4_framer_out(wc, x, 0x44, timing | (x << 6));
+		__t4_pci_out(wc, WC_DMACTRL, wc->dmactrl);
 	}
 #if	0
 	printk("wct4xxp: Timing source set to %d\n",unit);
@@ -1420,6 +1424,7 @@
 static int __devinit t4_launch(struct t4 *wc)
 {
 	int x;
+	unsigned long flags;
 	if (wc->spans[0].flags & ZT_FLAG_REGISTERED)
 		return 0;
 	printk("TE410P: Launching card: %d\n", wc->order);
@@ -1455,7 +1460,9 @@
 	if (debug)
 		printk("Timing source selected\n");
 	wc->checktiming = 1;
+	spin_lock_irqsave(&wc->reglock, flags);
 	__t4_set_timing_source(wc,4);
+	spin_unlock_irqrestore(&wc->reglock, flags);
 #ifdef ENABLE_TASKLETS
 	tasklet_init(&wc->t4_tlet, t4_tasklet, (unsigned long)wc);
 #endif




More information about the svn-commits mailing list