[svn-commits] sruffell: branch linux/sruffell/chan_list_refactoring r9266 - /linux/team/sru...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Sep 2 12:41:08 CDT 2010


Author: sruffell
Date: Thu Sep  2 12:40:57 2010
New Revision: 9266

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9266
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.

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

Modified: linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c?view=diff&rev=9266&r1=9265&r2=9266
==============================================================================
--- linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c Thu Sep  2 12:40:57 2010
@@ -8452,22 +8452,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 */
@@ -8477,7 +8477,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++];
@@ -8486,21 +8486,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 svn-commits mailing list