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

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


Author: sruffell
Date: Thu Sep  2 12:41:00 2010
New Revision: 9268

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

Simplifies the function and may increase performance due to decreased
dereferencing of the span and channel array.

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=9268&r1=9267&r2=9268
==============================================================================
--- 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:41:00 2010
@@ -8743,9 +8743,10 @@
 	span->watchcounter--;
 #endif
 	for (x=0;x<span->channels;x++) {
-		if (span->chans[x]->master == span->chans[x]) {
-			spin_lock_irqsave(&span->chans[x]->lock, flags);
-			if (span->chans[x]->nextslave) {
+		struct dahdi_chan *const chan = span->chans[x];
+		if (chan->master == chan) {
+			spin_lock_irqsave(&chan->lock, flags);
+			if (chan->nextslave) {
 				/* Must process each slave at the same time */
 				u_char data[DAHDI_CHUNKSIZE];
 				int pos = 0;
@@ -8755,8 +8756,8 @@
 					do {
 						data[pos++] = span->chans[z]->readchunk[y];
 						if (pos == DAHDI_CHUNKSIZE) {
-							if(!(span->chans[x]->flags & DAHDI_FLAG_NOSTDTXRX))
-								__dahdi_receive_chunk(span->chans[x], data);
+							if (!(chan->flags & DAHDI_FLAG_NOSTDTXRX))
+								__dahdi_receive_chunk(chan, data);
 							pos = 0;
 						}
 						z=span->chans[z]->nextslave;
@@ -8764,57 +8765,56 @@
 				}
 			} else {
 				/* Process a normal channel */
-				if (!(span->chans[x]->flags & DAHDI_FLAG_NOSTDTXRX))
-					__dahdi_real_receive(span->chans[x]);
+				if (!(chan->flags & DAHDI_FLAG_NOSTDTXRX))
+					__dahdi_real_receive(chan);
 			}
-			if (span->chans[x]->itimer) {
-				span->chans[x]->itimer -= DAHDI_CHUNKSIZE;
-				if (span->chans[x]->itimer <= 0) {
-					rbs_itimer_expire(span->chans[x]);
+			if (chan->itimer) {
+				chan->itimer -= DAHDI_CHUNKSIZE;
+				if (chan->itimer <= 0)
+					rbs_itimer_expire(chan);
+			}
+			if (chan->ringdebtimer)
+				chan->ringdebtimer--;
+			if (chan->sig & __DAHDI_SIG_FXS) {
+				if (chan->rxhooksig == DAHDI_RXSIG_RING)
+					chan->ringtrailer = DAHDI_RINGTRAILER;
+				else if (chan->ringtrailer) {
+					chan->ringtrailer -= DAHDI_CHUNKSIZE;
+					/* See if RING trailer is expired */
+					if (!chan->ringtrailer && !chan->ringdebtimer)
+						__qevent(chan, DAHDI_EVENT_RINGOFFHOOK);
 				}
 			}
-			if (span->chans[x]->ringdebtimer)
-				span->chans[x]->ringdebtimer--;
-			if (span->chans[x]->sig & __DAHDI_SIG_FXS) {
-				if (span->chans[x]->rxhooksig == DAHDI_RXSIG_RING)
-					span->chans[x]->ringtrailer = DAHDI_RINGTRAILER;
-				else if (span->chans[x]->ringtrailer) {
-					span->chans[x]->ringtrailer-= DAHDI_CHUNKSIZE;
-					/* See if RING trailer is expired */
-					if (!span->chans[x]->ringtrailer && !span->chans[x]->ringdebtimer)
-						__qevent(span->chans[x],DAHDI_EVENT_RINGOFFHOOK);
-				}
-			}
-			if (span->chans[x]->pulsetimer)
+			if (chan->pulsetimer)
 			{
-				span->chans[x]->pulsetimer--;
-				if (span->chans[x]->pulsetimer <= 0)
+				chan->pulsetimer--;
+				if (chan->pulsetimer <= 0)
 				{
-					if (span->chans[x]->pulsecount)
+					if (chan->pulsecount)
 					{
-						if (span->chans[x]->pulsecount > 12) {
+						if (chan->pulsecount > 12) {
 
 							module_printk(KERN_NOTICE, "Got pulse digit %d on %s???\n",
-						    span->chans[x]->pulsecount,
-							span->chans[x]->name);
-						} else if (span->chans[x]->pulsecount > 11) {
-							__qevent(span->chans[x], DAHDI_EVENT_PULSEDIGIT | '#');
-						} else if (span->chans[x]->pulsecount > 10) {
-							__qevent(span->chans[x], DAHDI_EVENT_PULSEDIGIT | '*');
-						} else if (span->chans[x]->pulsecount > 9) {
-							__qevent(span->chans[x], DAHDI_EVENT_PULSEDIGIT | '0');
+						    chan->pulsecount,
+							chan->name);
+						} else if (chan->pulsecount > 11) {
+							__qevent(chan, DAHDI_EVENT_PULSEDIGIT | '#');
+						} else if (chan->pulsecount > 10) {
+							__qevent(chan, DAHDI_EVENT_PULSEDIGIT | '*');
+						} else if (chan->pulsecount > 9) {
+							__qevent(chan, DAHDI_EVENT_PULSEDIGIT | '0');
 						} else {
-							__qevent(span->chans[x], DAHDI_EVENT_PULSEDIGIT | ('0' +
-								span->chans[x]->pulsecount));
+							__qevent(chan, DAHDI_EVENT_PULSEDIGIT | ('0' +
+								chan->pulsecount));
 						}
-						span->chans[x]->pulsecount = 0;
+						chan->pulsecount = 0;
 					}
 				}
 			}
 #ifdef BUFFER_DEBUG
-			span->chans[x]->statcount -= DAHDI_CHUNKSIZE;
-#endif
-			spin_unlock_irqrestore(&span->chans[x]->lock, flags);
+			chan->statcount -= DAHDI_CHUNKSIZE;
+#endif
+			spin_unlock_irqrestore(&chan->lock, flags);
 		}
 	}
 




More information about the svn-commits mailing list