[svn-commits] sruffell: branch linux/sruffell/dahdi-linux-cmdqueue r6034 - /linux/team/sruf...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Feb 24 14:36:10 CST 2009


Author: sruffell
Date: Tue Feb 24 14:36:09 2009
New Revision: 6034

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6034
Log:
Some more lock cleanup, and use the atomic operations for the span flags.

Modified:
    linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c

Modified: linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c?view=diff&rev=6034&r1=6033&r2=6034
==============================================================================
--- linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c Tue Feb 24 14:36:09 2009
@@ -573,9 +573,6 @@
 
 static void t1xxp_framer_start(struct t1 *wc, struct dahdi_span *span)
 {
-	int alreadyrunning = wc->span.flags & DAHDI_FLAG_RUNNING;
-	unsigned long flags;
-
 	if (wc->spantype == TYPE_E1) { /* if this is an E1 card */
 		t1_configure_e1(wc, span->lineconfig);
 	} else { /* is a T1 card */
@@ -583,10 +580,7 @@
 		__t1xxp_set_clear(wc, -1);
 	}
 
-	spin_lock_irqsave(&wc->reglock, flags);
-	if (!alreadyrunning) 
-		wc->span.flags |= DAHDI_FLAG_RUNNING;
-	spin_unlock_irqrestore(&wc->reglock, flags);
+	set_bit(DAHDI_FLAGBIT_RUNNING, &wc->span.flags);
 }
 
 static int t1xxp_startup(struct dahdi_span *span)
@@ -707,7 +701,7 @@
 {
 	int a,i,rxs;
 
-	if (!(wc->span.flags & DAHDI_FLAG_RUNNING))
+	if (!(test_bit(DAHDI_FLAGBIT_RUNNING, &wc->span.flags)))
 		return;
 	if (wc->spantype == TYPE_E1) {
 		for (i = 0; i < 15; i++) {
@@ -717,17 +711,13 @@
 				rxs = (a & 0xf);
 				if (!(wc->span.chans[i+16]->sig & DAHDI_SIG_CLEAR)) {
 					if (wc->span.chans[i+16]->rxsig != rxs) {
-						spin_unlock(&wc->reglock);
 						dahdi_rbsbits(wc->span.chans[i+16], rxs);
-						spin_lock(&wc->reglock);
 					}
 				}
 				rxs = (a >> 4) & 0xf;
 				if (!(wc->span.chans[i]->sig & DAHDI_SIG_CLEAR)) {
 					if (wc->span.chans[i]->rxsig != rxs) {
-						spin_unlock(&wc->reglock);
 						dahdi_rbsbits(wc->span.chans[i], rxs);
-						spin_lock(&wc->reglock);
 					}
 				}
 			}
@@ -740,33 +730,25 @@
 				rxs = (a & 0x3) << 2;
 				if (!(wc->span.chans[i+3]->sig & DAHDI_SIG_CLEAR)) {
 					if (wc->span.chans[i+3]->rxsig != rxs) {
-						spin_unlock(&wc->reglock);
 						dahdi_rbsbits(wc->span.chans[i+3], rxs);
-						spin_lock(&wc->reglock);
 					}
 				}
 				rxs = (a & 0xc);
 				if (!(wc->span.chans[i+2]->sig & DAHDI_SIG_CLEAR)) {
 					if (wc->span.chans[i+2]->rxsig != rxs) {
-						spin_unlock(&wc->reglock);
 						dahdi_rbsbits(wc->span.chans[i+2], rxs);
-						spin_lock(&wc->reglock);
 					}
 				}
 				rxs = (a >> 2) & 0xc;
 				if (!(wc->span.chans[i+1]->sig & DAHDI_SIG_CLEAR)) {
 					if (wc->span.chans[i+1]->rxsig != rxs) {
-						spin_unlock(&wc->reglock);
 						dahdi_rbsbits(wc->span.chans[i+1], rxs);
-						spin_lock(&wc->reglock);
 					}
 				}
 				rxs = (a >> 4) & 0xc;
 				if (!(wc->span.chans[i]->sig & DAHDI_SIG_CLEAR)) {
 					if (wc->span.chans[i]->rxsig != rxs) {
-						spin_unlock(&wc->reglock);
 						dahdi_rbsbits(wc->span.chans[i], rxs);
-						spin_lock(&wc->reglock);
 					}	
 				}
 			}
@@ -779,17 +761,13 @@
 				rxs = (a & 0xf);
 				if (!(wc->span.chans[i+1]->sig & DAHDI_SIG_CLEAR)) {
 					if (wc->span.chans[i+1]->rxsig != rxs) {
-						spin_unlock(&wc->reglock);
 						dahdi_rbsbits(wc->span.chans[i+1], rxs);
-						spin_lock(&wc->reglock);
 					}
 				}
 				rxs = (a >> 4) & 0xf;
 				if (!(wc->span.chans[i]->sig & DAHDI_SIG_CLEAR)) {
 					if (wc->span.chans[i]->rxsig != rxs) {
-						spin_unlock(&wc->reglock);
 						dahdi_rbsbits(wc->span.chans[i], rxs);
-						spin_lock(&wc->reglock);
 					}
 				}
 			}
@@ -1032,7 +1010,7 @@
 		wc->span.deflaw = DAHDI_LAW_MULAW;
 	}
 	wc->span.chans = wc->chans;
-	wc->span.flags = DAHDI_FLAG_RBS;
+	set_bit(DAHDI_FLAGBIT_RBS, &wc->span.flags);
 	wc->span.pvt = wc;
 	init_waitqueue_head(&wc->span.maintq);
 	for (x = 0; x < wc->span.channels; x++) {
@@ -1131,7 +1109,7 @@
 	int x,j;
 	unsigned char fmr4; /* must read this always */
 
-	if (!(wc->span.flags & DAHDI_FLAG_RUNNING))
+	if (!(test_bit(DAHDI_FLAGBIT_RUNNING, &wc->span.flags)))
 		return;
 
 	c = t1_getreg(wc, 0x4c);
@@ -1257,7 +1235,7 @@
 			led = SET_LED_ORANGE(led);
 		else
 			led = UNSET_LED_ORANGE(led);
-		if (wc->span.flags & DAHDI_FLAG_RUNNING)
+		if (test_bit(DAHDI_FLAGBIT_RUNNING, &wc->span.flags))
 			led = SET_LED_GREEN(led); 
 		else
 			led = UNSET_LED_REDGREEN(led); 
@@ -1369,10 +1347,6 @@
 t1_handle_transmit(void* vbb, void* context)
 {
 	struct t1* wc = context;
-	/* Either this function is called from within interrupt context, or
-	 * the reglock will never be acquired from interrupt context, so it's
-	 * safe to grab it without locking interrupt.
-	 */
 	memset(vbb, 0, SFRAME_SIZE);
 	atomic_inc(&wc->txints);
 	t1_transmitprep(wc, vbb);
@@ -1383,10 +1357,6 @@
 t1_handle_receive(void* vbb, void* context)
 {
 	struct t1* wc = context;
-	/* Either this function is called from within interrupt context, or
-	 * the reglock will never be acquired from interrupt context, so it's
-	 * safe to grab it without locking interrupt.
-	 */
 	t1_receiveprep(wc, vbb);
 }
 
@@ -1405,7 +1375,7 @@
 	t1_do_counters(wc);
 	t1_check_alarms(wc);
 	t1_check_sigbits(wc);
-	mod_timer(&wc->timer, jiffies + HZ/10);
+	mod_timer(&wc->timer, jiffies + HZ/5);
 }
 
 static void 
@@ -1502,7 +1472,7 @@
 		memset(wc->chans[x], 0, sizeof(*wc->chans[x]));
 	}
 
-	mod_timer(&wc->timer, jiffies + HZ/10);
+	mod_timer(&wc->timer, jiffies + HZ/5);
 	t1_software_init(wc);
 	if (voicebus_current_latency(wc->vb) > startinglatency) {
 		/* The voicebus library increased the latency during




More information about the svn-commits mailing list