[dahdi-commits] sruffell: linux/trunk r9362 - /linux/trunk/drivers/dahdi/dahdi-base.c

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Mon Sep 20 15:33:11 CDT 2010


Author: sruffell
Date: Mon Sep 20 15:33:07 2010
New Revision: 9362

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9362
Log:
dahdi: Use 'chan' convenience pointer in dahdi_transmit.

I believe this makes it a little more clear what is happening.  Also could
provide a potential speedup if the span doesn't need to be constantly
dereferenced (although an optimizer might make this moot).  Regardless, this
change doesn't hurt.

Review: https://reviewboard.asterisk.org/r/905/

Signed-off-by: Shaun Ruffell <sruffell at digium.com>

Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c

Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=9362&r1=9361&r2=9362
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Sep 20 15:33:07 2010
@@ -8427,22 +8427,22 @@
 	unsigned long flags;
 
 	for (x=0;x<span->channels;x++) {
-		spin_lock_irqsave(&span->chans[x]->lock, flags);
-		if (span->chans[x]->flags & DAHDI_FLAG_NOSTDTXRX) {
-			spin_unlock_irqrestore(&span->chans[x]->lock, flags);
+		struct dahdi_chan *const chan = span->chans[x];
+		spin_lock_irqsave(&chan->lock, flags);
+		if (chan->flags & DAHDI_FLAG_NOSTDTXRX) {
+			spin_unlock_irqrestore(&chan->lock, flags);
 			continue;
 		}
-		if (span->chans[x] == span->chans[x]->master) {
-			if (span->chans[x]->otimer) {
-				span->chans[x]->otimer -= DAHDI_CHUNKSIZE;
-				if (span->chans[x]->otimer <= 0) {
-					__rbs_otimer_expire(span->chans[x]);
-				}
+		if (chan == chan->master) {
+			if (chan->otimer) {
+				chan->otimer -= DAHDI_CHUNKSIZE;
+				if (chan->otimer <= 0)
+					__rbs_otimer_expire(chan);
 			}
-			if (span->chans[x]->flags & DAHDI_FLAG_AUDIO) {
-				__dahdi_real_transmit(span->chans[x]);
+			if (chan->flags & DAHDI_FLAG_AUDIO) {
+				__dahdi_real_transmit(chan);
 			} else {
-				if (span->chans[x]->nextslave) {
+				if (chan->nextslave) {
 					u_char data[DAHDI_CHUNKSIZE];
 					int pos=DAHDI_CHUNKSIZE;
 					/* Process master/slaves one way */
@@ -8452,7 +8452,7 @@
 						do {
 							if (pos==DAHDI_CHUNKSIZE) {
 								/* Get next chunk */
-								__dahdi_transmit_chunk(span->chans[x], data);
+								__dahdi_transmit_chunk(chan, data);
 								pos = 0;
 							}
 							span->chans[z]->writechunk[y] = data[pos++];
@@ -8461,21 +8461,21 @@
 					}
 				} else {
 					/* Process independents elsewise */
-					__dahdi_real_transmit(span->chans[x]);
+					__dahdi_real_transmit(chan);
 				}
 			}
-			if (span->chans[x]->sig == DAHDI_SIG_DACS_RBS) {
-				if (chans[span->chans[x]->confna]) {
+			if (chan->sig == DAHDI_SIG_DACS_RBS) {
+				struct dahdi_chan *const conf =
+							chans[chan->confna];
+				if (conf && (chan->txsig != conf->rxsig)) {
 				    	/* Just set bits for our destination */
-					if (span->chans[x]->txsig != chans[span->chans[x]->confna]->rxsig) {
-						span->chans[x]->txsig = chans[span->chans[x]->confna]->rxsig;
-						span->ops->rbsbits(span->chans[x], chans[span->chans[x]->confna]->rxsig);
-					}
+					chan->txsig = conf->rxsig;
+					span->ops->rbsbits(chan, conf->rxsig);
 				}
 			}
 
 		}
-		spin_unlock_irqrestore(&span->chans[x]->lock, flags);
+		spin_unlock_irqrestore(&chan->lock, flags);
 	}
 	if (span->mainttimer) {
 		span->mainttimer -= DAHDI_CHUNKSIZE;




More information about the dahdi-commits mailing list